diff --git a/CoreStoreDemo/CoreStoreDemo/Fetching and Querying Demo/FetchingAndQueryingDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/Fetching and Querying Demo/FetchingAndQueryingDemoViewController.swift index f1d7d4d..cfee272 100644 --- a/CoreStoreDemo/CoreStoreDemo/Fetching and Querying Demo/FetchingAndQueryingDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/Fetching and Querying Demo/FetchingAndQueryingDemoViewController.swift @@ -230,15 +230,15 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo ) ] - private let queryingItems = [ + private let queryingItems: [(title: String, query: () -> Any)] = [ ( title: "Number of Time Zones", query: { () -> Any in return Static.timeZonesStack.queryValue( - From(), - Select(.count(#keyPath(TimeZone.name))) - )! + From() + .select(NSNumber.self, .count(#keyPath(TimeZone.name))) + )! as Any } ), ( @@ -246,10 +246,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo query: { () -> Any in return Static.timeZonesStack.queryValue( - From(), - Select(#keyPath(TimeZone.abbreviation)), - Where("%K ENDSWITH[c] %@", #keyPath(TimeZone.name), "Tokyo") - )! + From() + .select(String.self, .attribute(#keyPath(TimeZone.abbreviation))) + .where(format: "%K ENDSWITH[c] %@", #keyPath(TimeZone.name), "Tokyo") + )! as Any } ), ( @@ -257,9 +257,13 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo query: { () -> Any in return Static.timeZonesStack.queryAttributes( - From(), - Select(#keyPath(TimeZone.name), #keyPath(TimeZone.abbreviation)), - OrderBy(.ascending(#keyPath(TimeZone.name))) + From() + .select( + NSDictionary.self, + .attribute(#keyPath(TimeZone.name)), + .attribute(#keyPath(TimeZone.abbreviation)) + ) + .orderBy(.ascending(#keyPath(TimeZone.name))) )! } ), @@ -268,10 +272,17 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo query: { () -> Any in return Static.timeZonesStack.queryAttributes( - From(), - Select(.count(#keyPath(TimeZone.abbreviation)), #keyPath(TimeZone.abbreviation)), - GroupBy(#keyPath(TimeZone.abbreviation)), - OrderBy(.ascending(#keyPath(TimeZone.secondsFromGMT)), .ascending(#keyPath(TimeZone.name))) + From() + .select( + NSDictionary.self, + .count(#keyPath(TimeZone.abbreviation)), + .attribute(#keyPath(TimeZone.abbreviation)) + ) + .groupBy(#keyPath(TimeZone.abbreviation)) + .orderBy( + .ascending(#keyPath(TimeZone.secondsFromGMT)), + .ascending(#keyPath(TimeZone.name)) + ) )! } ), @@ -285,8 +296,8 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo .count(#keyPath(TimeZone.hasDaylightSavingTime), as: "numberOfCountries"), #keyPath(TimeZone.hasDaylightSavingTime) ), - GroupBy(#keyPath(TimeZone.hasDaylightSavingTime)), - OrderBy(.descending(#keyPath(TimeZone.hasDaylightSavingTime))) + GroupBy(#keyPath(TimeZone.hasDaylightSavingTime)), + OrderBy(.descending(#keyPath(TimeZone.hasDaylightSavingTime))) )! } ) diff --git a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift index baffca5..9227773 100644 --- a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift @@ -370,8 +370,8 @@ class MigrationsDemoViewController: UIViewController, ListObserver, UITableViewD self._dataStack = dataStack let listMonitor = dataStack.monitorList( - From(model.entityType) - .orderBy(.descending(#keyPath(OrganismV1.dna))) + From(model.entityType), + OrderBy(.descending(#keyPath(OrganismV1.dna))) ) listMonitor.addObserver(self) self._listMonitor = listMonitor