Scope

public final class Scope

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.

  • The default scope name constant

    Declaration

    Swift

    public static let defaultScopeName: String
  • Scope name

    Declaration

    Swift

    public var name: String { get }
  • Get all collections in the scope.

    Declaration

    Swift

    public func collections() throws -> [Collection]
  • Get a collection in the scope by name. If the collection doesn’t exist, a nil value will be returned.

    Declaration

    Swift

    public func collection(name: String) throws -> Collection?