fix Demo app compiler errors

This commit is contained in:
John Estropia
2017-09-19 16:22:59 +09:00
parent fd1ce20863
commit 0d23ce1598
2 changed files with 30 additions and 19 deletions

View File

@@ -230,15 +230,15 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
) )
] ]
private let queryingItems = [ private let queryingItems: [(title: String, query: () -> Any)] = [
( (
title: "Number of Time Zones", title: "Number of Time Zones",
query: { () -> Any in query: { () -> Any in
return Static.timeZonesStack.queryValue( return Static.timeZonesStack.queryValue(
From<TimeZone>(), From<TimeZone>()
Select<NSNumber>(.count(#keyPath(TimeZone.name))) .select(NSNumber.self, .count(#keyPath(TimeZone.name)))
)! )! as Any
} }
), ),
( (
@@ -246,10 +246,10 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
query: { () -> Any in query: { () -> Any in
return Static.timeZonesStack.queryValue( return Static.timeZonesStack.queryValue(
From<TimeZone>(), From<TimeZone>()
Select<String>(#keyPath(TimeZone.abbreviation)), .select(String.self, .attribute(#keyPath(TimeZone.abbreviation)))
Where("%K ENDSWITH[c] %@", #keyPath(TimeZone.name), "Tokyo") .where(format: "%K ENDSWITH[c] %@", #keyPath(TimeZone.name), "Tokyo")
)! )! as Any
} }
), ),
( (
@@ -257,9 +257,13 @@ class FetchingAndQueryingDemoViewController: UIViewController, UITableViewDataSo
query: { () -> Any in query: { () -> Any in
return Static.timeZonesStack.queryAttributes( return Static.timeZonesStack.queryAttributes(
From<TimeZone>(), From<TimeZone>()
Select<NSDictionary>(#keyPath(TimeZone.name), #keyPath(TimeZone.abbreviation)), .select(
OrderBy(.ascending(#keyPath(TimeZone.name))) 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 query: { () -> Any in
return Static.timeZonesStack.queryAttributes( return Static.timeZonesStack.queryAttributes(
From<TimeZone>(), From<TimeZone>()
Select<NSDictionary>(.count(#keyPath(TimeZone.abbreviation)), #keyPath(TimeZone.abbreviation)), .select(
GroupBy(#keyPath(TimeZone.abbreviation)), NSDictionary.self,
OrderBy(.ascending(#keyPath(TimeZone.secondsFromGMT)), .ascending(#keyPath(TimeZone.name))) .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"), .count(#keyPath(TimeZone.hasDaylightSavingTime), as: "numberOfCountries"),
#keyPath(TimeZone.hasDaylightSavingTime) #keyPath(TimeZone.hasDaylightSavingTime)
), ),
GroupBy(#keyPath(TimeZone.hasDaylightSavingTime)), GroupBy<TimeZone>(#keyPath(TimeZone.hasDaylightSavingTime)),
OrderBy(.descending(#keyPath(TimeZone.hasDaylightSavingTime))) OrderBy<TimeZone>(.descending(#keyPath(TimeZone.hasDaylightSavingTime)))
)! )!
} }
) )

View File

@@ -370,8 +370,8 @@ class MigrationsDemoViewController: UIViewController, ListObserver, UITableViewD
self._dataStack = dataStack self._dataStack = dataStack
let listMonitor = dataStack.monitorList( let listMonitor = dataStack.monitorList(
From(model.entityType) From(model.entityType),
.orderBy(.descending(#keyPath(OrganismV1.dna))) OrderBy<NSManagedObject>(.descending(#keyPath(OrganismV1.dna)))
) )
listMonitor.addObserver(self) listMonitor.addObserver(self)
self._listMonitor = listMonitor self._listMonitor = listMonitor