diff --git a/CoreStoreTests/SectionByTests.swift b/CoreStoreTests/SectionByTests.swift index eb23457..a0711e3 100644 --- a/CoreStoreTests/SectionByTests.swift +++ b/CoreStoreTests/SectionByTests.swift @@ -41,11 +41,14 @@ final class SectionByTests: XCTestCase { let sectionBy = SectionBy("key") XCTAssertEqual(sectionBy.sectionKeyPath, "key") - XCTAssertEqual(sectionBy.sectionIndexTransformer("key"), "key") + XCTAssertNil(sectionBy.sectionIndexTransformer("key")) } do { - let sectionBy = SectionBy("key") { $0.flatMap { "\($0):suffix" } } + let sectionBy = SectionBy( + "key", + sectionIndexTransformer: { $0.flatMap { "\($0):suffix" } } + ) XCTAssertEqual(sectionBy.sectionKeyPath, "key") XCTAssertEqual(sectionBy.sectionIndexTransformer("key"), "key:suffix") XCTAssertNil(sectionBy.sectionIndexTransformer(nil)) diff --git a/Sources/CSSectionBy.swift b/Sources/CSSectionBy.swift index fe829e7..0755cf6 100644 --- a/Sources/CSSectionBy.swift +++ b/Sources/CSSectionBy.swift @@ -60,7 +60,12 @@ public final class CSSectionBy: NSObject { @objc public static func keyPath(_ sectionKeyPath: KeyPathString, sectionIndexTransformer: @escaping (_ sectionName: String?) -> String?) -> CSSectionBy { - return self.init(SectionBy(sectionKeyPath, sectionIndexTransformer)) + return self.init( + SectionBy( + sectionKeyPath, + sectionIndexTransformer: sectionIndexTransformer + ) + ) } @@ -101,6 +106,9 @@ extension SectionBy { fileprivate func downcast() -> SectionBy { - return SectionBy(self.sectionKeyPath, self.sectionIndexTransformer) + return SectionBy( + self.sectionKeyPath, + sectionIndexTransformer: self.sectionIndexTransformer + ) } } diff --git a/Sources/From+Querying.swift b/Sources/From+Querying.swift index 483b438..0d9a4d6 100644 --- a/Sources/From+Querying.swift +++ b/Sources/From+Querying.swift @@ -259,7 +259,10 @@ extension From { return .init( from: self, - sectionBy: .init(sectionKeyPath, sectionIndexTransformer), + sectionBy: .init( + sectionKeyPath, + sectionIndexTransformer: sectionIndexTransformer + ), fetchClauses: [] ) }