Skip to content

Commit 6152ee3

Browse files
committed
Documentation updates
1 parent f11f6b8 commit 6152ee3

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

Documentation/Index.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
## Installation
6767

68-
> _Note:_ SQLite.swift requires Swift 2 (and [Xcode 7](https://developer.apple.com/xcode/downloads/)) or greater.
68+
> _Note:_ SQLite.swift requires Swift 3 (and [Xcode 8](https://developer.apple.com/xcode/downloads/)) or greater.
6969
7070

7171
### Carthage
@@ -203,10 +203,10 @@ On OS X, you can use your app’s **Application Support** directory:
203203
``` swift
204204
var path = NSSearchPathForDirectoriesInDomains(
205205
.applicationSupportDirectory, .userDomainMask, true
206-
).first! + NSBundle.mainBundle().bundleIdentifier!
206+
).first! + Bundle.main.bundleIdentifier!
207207

208208
// create parent directory iff it doesn’t exist
209-
try NSFileManager.defaultManager().createDirectoryAtPath(
209+
try FileManager.default.createDirectoryAtPath(
210210
path, withIntermediateDirectories: true, attributes: nil
211211
)
212212

@@ -219,7 +219,7 @@ let db = try Connection("\(path)/db.sqlite3")
219219
If you bundle a database with your app (_i.e._, you’ve copied a database file into your Xcode project and added it to your application target), you can establish a _read-only_ connection to it.
220220

221221
``` swift
222-
let path = NSBundle.mainBundle().pathForResource("db", ofType: "sqlite3")!
222+
let path = Bundle.main.pathForResource("db", ofType: "sqlite3")!
223223

224224
let db = try Connection(path, readonly: true)
225225
```
@@ -1114,41 +1114,41 @@ Once extended, the type can be used [_almost_](#custom-type-caveats) wherever ty
11141114

11151115
### Date-Time Values
11161116

1117-
In SQLite, `DATETIME` columns can be treated as strings or numbers, so we can transparently bridge `NSDate` objects through Swift’s `String` or `Int` types.
1117+
In SQLite, `DATETIME` columns can be treated as strings or numbers, so we can transparently bridge `Date` objects through Swift’s `String` or `Int` types.
11181118

1119-
To serialize `NSDate` objects as `TEXT` values (in ISO 8601), we’ll use `String`.
1119+
To serialize `Date` objects as `TEXT` values (in ISO 8601), we’ll use `String`.
11201120

11211121
``` swift
1122-
extension NSDate: Value {
1122+
extension Date: Value {
11231123
class var declaredDatatype: String {
11241124
return String.declaredDatatype
11251125
}
1126-
class func fromDatatypeValue(stringValue: String) -> NSDate {
1126+
class func fromDatatypeValue(stringValue: String) -> Date {
11271127
return SQLDateFormatter.dateFromString(stringValue)!
11281128
}
11291129
var datatypeValue: String {
11301130
return SQLDateFormatter.stringFromDate(self)
11311131
}
11321132
}
11331133

1134-
let SQLDateFormatter: NSDateFormatter = {
1135-
let formatter = NSDateFormatter()
1134+
let SQLDateFormatter: DateFormatter = {
1135+
let formatter = DateFormatter()
11361136
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"
1137-
formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
1138-
formatter.timeZone = NSTimeZone(forSecondsFromGMT: 0)
1137+
formatter.locale = Locale(localeIdentifier: "en_US_POSIX")
1138+
formatter.timeZone = TimeZone(forSecondsFromGMT: 0)
11391139
return formatter
11401140
}()
11411141
```
11421142

11431143
We can also treat them as `INTEGER` values using `Int`.
11441144

11451145
``` swift
1146-
extension NSDate: Value {
1146+
extension Date: Value {
11471147
class var declaredDatatype: String {
11481148
return Int.declaredDatatype
11491149
}
11501150
class func fromDatatypeValue(intValue: Int) -> Self {
1151-
return self(timeIntervalSince1970: NSTimeInterval(intValue))
1151+
return self(timeIntervalSince1970: TimeInterval(intValue))
11521152
}
11531153
var datatypeValue: Int {
11541154
return Int(timeIntervalSince1970)
@@ -1161,9 +1161,9 @@ extension NSDate: Value {
11611161
Once defined, we can use these types directly in SQLite statements.
11621162

11631163
``` swift
1164-
let published_at = Expression<NSDate>("published_at")
1164+
let published_at = Expression<Date>("published_at")
11651165

1166-
let published = posts.filter(published_at <= NSDate())
1166+
let published = posts.filter(published_at <= Date())
11671167
// extension where Datatype == String:
11681168
// SELECT * FROM "posts" WHERE "published_at" <= '2014-11-18 12:45:30'
11691169
// extension where Datatype == Int:
@@ -1175,10 +1175,10 @@ let published = posts.filter(published_at <= NSDate())
11751175

11761176
Any object that can be encoded and decoded can be stored as a blob of data in SQL.
11771177

1178-
We can create an `NSData` bridge rather trivially.
1178+
We can create an `Data` bridge rather trivially.
11791179

11801180
``` swift
1181-
extension NSData: Value {
1181+
extension Data: Value {
11821182
class var declaredDatatype: String {
11831183
return Blob.declaredDatatype
11841184
}
@@ -1191,16 +1191,16 @@ extension NSData: Value {
11911191
}
11921192
```
11931193

1194-
We can bridge any type that can be initialized from and encoded to `NSData`.
1194+
We can bridge any type that can be initialized from and encoded to `Data`.
11951195

11961196
``` swift
1197-
// assumes NSData conformance, above
1197+
// assumes Data conformance, above
11981198
extension UIImage: Value {
11991199
public class var declaredDatatype: String {
12001200
return Blob.declaredDatatype
12011201
}
12021202
public class func fromDatatypeValue(blobValue: Blob) -> UIImage {
1203-
return UIImage(data: NSData.fromDatatypeValue(blobValue))!
1203+
return UIImage(data: Data.fromDatatypeValue(blobValue))!
12041204
}
12051205
public var datatypeValue: Blob {
12061206
return UIImagePNGRepresentation(self)!.datatypeValue

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SQLite.swift
22

3-
[![Build Status][Badge]][Travis] [![CocoaPods Version](https://cocoapod-badges.herokuapp.com/v/SQLite.swift/badge.png)](http://cocoadocs.org/docsets/SQLite.swift) [![Platform](https://cocoapod-badges.herokuapp.com/p/SQLite.swift/badge.png)](http://cocoadocs.org/docsets/SQLite.swift) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Join the chat at https://gitter.im/stephencelis/SQLite.swift](https://badges.gitter.im/stephencelis/SQLite.swift.svg)](https://gitter.im/stephencelis/SQLite.swift)
3+
[![Build Status][Badge]][Travis] [![CocoaPods Version](https://cocoapod-badges.herokuapp.com/v/SQLite.swift/badge.png)](http://cocoadocs.org/docsets/SQLite.swift) [![Swift](https://img.shields.io/badge/swift-3-orange.svg?style=flat)](https://developer.apple.com/swift/) [![Platform](https://cocoapod-badges.herokuapp.com/p/SQLite.swift/badge.png)](http://cocoadocs.org/docsets/SQLite.swift) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Join the chat at https://gitter.im/stephencelis/SQLite.swift](https://badges.gitter.im/stephencelis/SQLite.swift.svg)](https://gitter.im/stephencelis/SQLite.swift)
44

55
A type-safe, [Swift][]-language layer over [SQLite3][].
66

@@ -109,7 +109,7 @@ For a more comprehensive example, see [this article](http://masteringswift.blogs
109109

110110
## Installation
111111

112-
> _Note:_ SQLite.swift requires Swift 2 (and [Xcode][] 7) or greater.
112+
> _Note:_ SQLite.swift requires Swift 3 (and [Xcode][] 8) or greater.
113113
>
114114
> The following instructions apply to targets that support embedded
115115
> Swift frameworks. To use SQLite.swift in iOS 7 or an OS X command line

0 commit comments

Comments
 (0)