diff options
author | Robert M. Ryan <robert.ryan@mindspring.com> | 2015-10-24 01:02:52 +0300 |
---|---|---|
committer | Robert M. Ryan <robert.ryan@mindspring.com> | 2015-10-24 01:02:52 +0300 |
commit | 64c9266a788bb429a3acf4b64b7422f57025ca6b (patch) | |
tree | 1b507b1df991f96db3fcfe720653e2f8a62dbbd2 /README.markdown | |
parent | 90a9353218cf907336d27f9a4952cd6d4858e014 (diff) |
Update README
Fix Swift code sample so that it doesn't try to do `stringByAppendingPathComponent` on `String` object (because that method no longer exists). You can use `NSString` or shift to use `NSURL` pattern as suggested here.
Diffstat (limited to 'README.markdown')
-rw-r--r-- | README.markdown | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/README.markdown b/README.markdown index 35550b5..7a52a0b 100644 --- a/README.markdown +++ b/README.markdown @@ -283,10 +283,10 @@ To do this, you must: If you do the above, you can then write Swift code that uses FMDatabase. For example: ```swift -let documentsFolder = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String -let path = documentsFolder.stringByAppendingPathComponent("test.sqlite") +let documents = try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false) +let fileURL = documents.URLByAppendingPathComponent("test.sqlite") -let database = FMDatabase(path: path) +let database = FMDatabase(path: fileURL.path) if !database.open() { println("Unable to open database") |