Parcourir la source

Revise README

- Eliminate discussion of `FMDatabaseQueue` no longer being optional in 2.7, because it actually is.
- Given new Apple guidance regarding "Documents" vs "Application Support", changed Swift example to use the latter instead of the former.
Robert M. Ryan il y a 8 ans
Parent
commit
78ea4d9221
1 fichiers modifiés avec 2 ajouts et 10 suppressions
  1. 2 10
      README.markdown

+ 2 - 10
README.markdown

@@ -91,13 +91,8 @@ FMDB 2.7 is largely the same as prior versions, but has been audited for nullabi
 For Swift users, this nullability audit results in changes that are not entirely backward compatible with FMDB 2.6, but is a little more Swifty. Before FMDB was audited for nullability, Swift was forced to defensively assume that variables were optional, but the library now more accurately knows which properties and method parameters are optional, and which are not.
 For Swift users, this nullability audit results in changes that are not entirely backward compatible with FMDB 2.6, but is a little more Swifty. Before FMDB was audited for nullability, Swift was forced to defensively assume that variables were optional, but the library now more accurately knows which properties and method parameters are optional, and which are not.
 
 
 This means, though, that Swift code written for FMDB 2.7 may require changes. For example, consider the following Swift 3/Swift 4 code for FMDB 2.6:
 This means, though, that Swift code written for FMDB 2.7 may require changes. For example, consider the following Swift 3/Swift 4 code for FMDB 2.6:
-```swift
-
-guard let queue = FMDatabaseQueue(path: fileURL.path) else {
-    print("Unable to create FMDatabaseQueue")
-    return
-}
 
 
+```swift
 queue.inTransaction { db, rollback in
 queue.inTransaction { db, rollback in
     do {
     do {
         guard let db == db else {
         guard let db == db else {
@@ -116,9 +111,6 @@ queue.inTransaction { db, rollback in
 Because FMDB 2.6 was not audited for nullability, Swift inferred that `db` and `rollback` were optionals. But, now, in FMDB 2.7, Swift now knows that, for example, neither `db` nor `rollback` above can be `nil`, so they are no longer optionals. Thus it becomes:
 Because FMDB 2.6 was not audited for nullability, Swift inferred that `db` and `rollback` were optionals. But, now, in FMDB 2.7, Swift now knows that, for example, neither `db` nor `rollback` above can be `nil`, so they are no longer optionals. Thus it becomes:
 
 
 ```swift
 ```swift
-
-let queue = FMDatabaseQueue(url: fileURL)
-
 queue.inTransaction { db, rollback in
 queue.inTransaction { db, rollback in
     do {
     do {
         try db.executeUpdate("INSERT INTO foo (bar) VALUES (?)", values: [1])
         try db.executeUpdate("INSERT INTO foo (bar) VALUES (?)", values: [1])
@@ -463,7 +455,7 @@ If you do the above, you can then write Swift code that uses `FMDatabase`. For e
 
 
 ```swift
 ```swift
 let fileURL = try! FileManager.default
 let fileURL = try! FileManager.default
-    .url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
+    .url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
     .appendingPathComponent("test.sqlite")
     .appendingPathComponent("test.sqlite")
 
 
 let database = FMDatabase(url: fileURL)
 let database = FMDatabase(url: fileURL)