Documentation for compound RowModel properties.

This commit is contained in:
Gwendal Roué committed 2015-09-03 14:02:38 +02:00
1 parent 79de258598
commit 36292ce4ef
1 file changed
+3 -3
+3 -3
View File
@@ -887,11 +887,13 @@ class Placemark : RowModel {
}
```
A solution is of course to declare two internal properties, latitude and longitude, and implement coordinate as a computed property. `setDatabaseValue()` would simply update latitude and longitude separately:
A solution is of course to declare two convenience properties, latitude and longitude, and implement coordinate on top of them, as a computed property. `setDatabaseValue()` would then update latitude and longitude separately:
```swift
// Solution 1: computed property:
class Placemark : RowModel {
var latitude: CLLocationDegrees?
var longitude: CLLocationDegrees?
var coordinate: CLLocationCoordinate2D? {
switch (latitude, longitude) {
case (let latitude?, let longitude?):
@@ -901,8 +903,6 @@ class Placemark : RowModel {
return nil
}
}
var latitude: CLLocationDegrees?
var longitude: CLLocationDegrees?
override func setDatabaseValue(dbv: DatabaseValue, forColumn column: String) {
switch column {