CBLScope

@interface CBLScope : NSObject

A CBLScope represents a scope or namespace of the collections.

The scope implicitly exists when there is at least one collection created under the scope. The default scope is exceptional in that it will always exists even there are no collections under it.

CBLScope Lifespan A CBLScope object remain valid until either the database is closed or the scope itself is invalidated as all collections in the scope have been deleted.

  • Scope name.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull name;
  • Scope name.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CBLDatabase *_Nonnull database;
  • Unavailable

    Not available

    Declaration

    Objective-C

    - (nonnull instancetype)init;

Collections

  • Get all collections in the scope.

    Declaration

    Objective-C

    - (nullable NSArray<CBLCollection *> *)collections:
        (NSError *_Nullable *_Nullable)error;

    Parameters

    error

    On return, the error if any.

    Return Value

    Collections in the scope, or nil if an error occurred.

  • Get a collection in the scope by name. If the collection doesn’t exist, a nil value will be returned.

    Declaration

    Objective-C

    - (nullable CBLCollection *)collectionWithName:(nonnull NSString *)name
                                             error:(NSError *_Nullable *_Nullable)
                                                       error;

    Parameters

    error

    On return, the error if any.

    Return Value

    Collection for the specified name, or nil if an error occurred.