-
Notifications
You must be signed in to change notification settings - Fork 301
v1.1 API Changes
Jens Alfke edited this page May 12, 2015
·
4 revisions
Here are all of the API changes from release 1.0.4 to 1.1 of Couchbase Lite for iOS (and Mac OS X.)
- The headers now use the new
nullableattribute. Any parameters that aren't prefixed withnullablemay not takenilvalues, and (starting in Xcode 6.3) will produce a compile error if you call them with a constantnilvalue. In Swift a non-nullable parameter will be typed as non-optional, e.g. of typeStringrather thanString?-- this will make your app code simpler and clearer.
- You can now read an attachment as a stream by calling
-openContentStream. (Just make sure to close the stream when you're done.)
-
-databaseExistsNamed:lets you query for the existence of a database without opening it. -
-registerEncryptionKey:forDatabaseNamed:is your entry point to database encryption. -
-replaceDatabaseNamed:... has changed its parameters due to the new database layout. Since a CBL database is now stored as a directory, with the SQLite database and attachments inside, you only need to provide that one directory's path when importing a database.
- Support for querying inverse relations:
- The new method
-findInverseOfRelation:fromClass:queries an inverse relation: it finds the other models in the database that have a specific property that references the receiver. See the header comments for more details. - It's also possible to declare a property whose value will be computed as an inverse-relation query, by implementing
+inverseRelationForArrayProperty:.
- The new method
- CBLModel now has no public initializer methods, and you should not implement any yourself in subclasses.
- Instead of calling
-initWithNewDocumentInDatabase:, call+modelForNewDocumentInDatabase:. - In a subclass, to set up transient state of an instance, override
-awakeFromInitializer.
- Instead of calling
- Added
-documentTypeForClass:and-documentTypesForClass:, to look up which JSONtypeproperty(ies) are associated with a particular CBLModel subclass.
-
CBLAllDocsModenow has a new value,kCBLBySequence, which produces a "changes feed" with documents ordered by their sequence number, i.e. in the order in which they were last changed. - CBLLiveQuery has a new method
-queryOptionsChanged. Call this if you change the query's options (startKey,endKey,descending, etc.) after the live query has started running, so it'll pick up the changes. - Removed
fullTextQueryandfullTextSnippetsproperties, as they're not supported with ForestDB storage.
New in this release, CBLQueryBuilder lets you create Core Data-like queries using NSPredicates without having to manually define map functions. See the documentation for details.
- The
.pendingDocumentIDsproperty and-isDocumentPending:method allow you to check which documents have local changes that haven't yet been pushed to the server.
- The
.documentTypeproperty can help optimize indexing performance. If set, only documents whose JSONtypeproperty is equal to that string will be passed to the map function; others are skipped. This avoids having to load and parse documents that your map function would ignore anyway. Note: This property is not persistent: you'll need to set it on every launch, when you set the view's map block.