Minor tweaks

This commit is contained in:
Gwendal Roué committed 2015-07-04 16:30:36 +02:00
1 parent c8bad5db25
commit edbd2e8d01
2 files changed
+10 -4

No files matched your search

+5 -2
View File
@@ -10,6 +10,9 @@ import XCTest
import GRDB
struct DatabaseDate: SQLiteValueConvertible {
// MARK: - DatabaseDate <-> NSDate conversion
let date: NSDate
// Define a failable initializer in order to consistently use nil as the
@@ -22,12 +25,12 @@ struct DatabaseDate: SQLiteValueConvertible {
}
}
// Date -> SQLite
// MARK: - DatabaseDate <-> SQLiteValue conversion
var sqliteValue: SQLiteValue {
return .Real(date.timeIntervalSince1970)
}
// SQLite -> Date
init?(sqliteValue: SQLiteValue) {
// Don't handle the raw SQLiteValue unless you know what you do.
// It is recommended to use GRDB built-in conversions instead:
+5 -2
View File
@@ -238,6 +238,9 @@ For example, let's define below the `DatabaseDate` type that stores and loads NS
```swift
struct DatabaseDate: SQLiteValueConvertible {
// MARK: - DatabaseDate <-> NSDate conversion
let date: NSDate
// Define a failable initializer in order to consistently use nil as the
@@ -250,12 +253,12 @@ struct DatabaseDate: SQLiteValueConvertible {
}
}
// Date -> SQLite
// MARK: - DatabaseDate <-> SQLiteValue conversion
var sqliteValue: SQLiteValue {
return .Real(date.timeIntervalSince1970)
}
// SQLite -> Date
init?(sqliteValue: SQLiteValue) {
// Don't handle the raw SQLiteValue unless you know what you do.
// It is recommended to use GRDB built-in conversions instead: