ZDCDatabaseConfig

@interface ZDCDatabaseConfig : NSObject

Container class for configuring the database. An instance of this class is passed to -[ZeroDarkCloud unlockOrCreateDatabase:].

  • Creates an instance using the single required property.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithEncryptionKey:(nonnull NSData *)encryptionKey;

    Swift

    init(encryptionKey: Data)
  • The encryptionKey is used for encrypting & decrypting the underlying data of the database. This is used by SQLCipher.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSData *_Nonnull encryptionKey;

    Swift

    var encryptionKey: Data { get }
  • Allows you to configure the database for your app.

    For example:

    • register a serializer/deserializer for your custom collections
    • register a YapDatabaseExtension, such as a view, for sorting & displaying information in a collectionView

    This block is invoked:

  • before the -[ZeroDarkCloud unlockOrCreateDatabase] returns
  • after ZeroDarkCloud has registered its own extensions

  • Note

    This block is NOT retained by ZeroDarkCloud, nor is the ZDCDatabaseConfig instance. So the block is deallocated when the ZDCDatabaseConfig instance is deallocated.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        YapDatabaseConfigHook configHook;

    Swift

    var configHook: YapDatabaseConfigHook? { get set }