Other Type Definitions

The following type definitions are available globally.

  • Used for configuring the database and registering your own custom YapDatabse extensions.

    For example:

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

    Declaration

    Objective-C

    typedef void (^YapDatabaseConfigHook)(int *_Nonnull)

    Swift

    typealias YapDatabaseConfigHook = (UnsafeMutablePointer<Int32>) -> Void
  • CompletionBlock for downloading a node’s meta components.

    Declaration

    Objective-C

    typedef void (^NodeMetaDownloadCompletionBlock)(ZDCCloudDataInfo *_Nullable,
                                                    NSData *_Nullable,
                                                    NSData *_Nullable,
                                                    NSError *_Nullable)

    Swift

    typealias NodeMetaDownloadCompletionBlock = (ZDCCloudDataInfo?, Data?, Data?, Error?) -> Void

    Parameters

    header

    The header block for the file, which contains the offsets of the various sections within the encrypted file. (The header block is also encrypted in the cloud - but it’s always at the very beginning of the file. So the framework knows how to fetch it & then decrypt it.) The header is automatically downloaded (if needed), and then cached in -[ZDCNode cloudDataInfo].

    metadata

    The (raw) metadata information stored in the node’s DATA file.

    thumbnail

    The (raw) thumbnail information stored in the node’s DATA file.

    error

    If an error occurs, this value is non-nil. Common errors, such as S3 throttling requests, are automatically handled for you.

  • CompletionBlock for downloading a node.

    On success, the file is downloaded and stored in a temporary location. It’s your responsibility to cleanup this file when you’re done - either by deleting the file, or moving it into a permananet location (e.g. by handing it over to the DiskManager). If you forget to cleanup the file, it’s stored in a temp directory, so theoretically the OS will eventually clean it up for you. But don’t play that game. That’s not cool. Cleanup your disk junk.

    The file is stored on disk in an encrypted format. See the ZDCCryptoFile class for information about the multiple tools available for decrypting & reading the file.

    Declaration

    Objective-C

    typedef void (^NodeDataDownloadCompletionBlock)(ZDCCloudDataInfo *_Nullable,
                                                    ZDCCryptoFile *_Nullable,
                                                    NSError *_Nullable)

    Swift

    typealias NodeDataDownloadCompletionBlock = (ZDCCloudDataInfo?, ZDCCryptoFile?, Error?) -> Void

    Parameters

    header

    The header block for the file, which contains the offsets of the various sections within the encrypted file. (The header block is also encrypted in the cloud - but it’s always at the very beginning of the file. So the framework knows how to fetch it & then decrypt it.) The header is automatically downloaded (if needed), and then cached in -[ZDCNode cloudDataInfo].

    cryptoFile

    The cryptoFile provides everything you need to read an encrypted file.

    error

    If an error occurs, this value is non-nil. Common errors, such as S3 throttling requests, are automatically handled for you.

  • CompletionBlock for downloading an avatar.

    Declaration

    Objective-C

    typedef void (^UserAvatarDownloadCompletionBlock)(NSData *_Nullable,
                                                      NSError *_Nullable)

    Swift

    typealias UserAvatarDownloadCompletionBlock = (Data?, Error?) -> Void

    Parameters

    avatar

    The (raw) avatar information downloaded from the URL.

    error

    If an error occurs, this value is non-nil.

  • The ImageProcessingBlock allows you to modify an image for presentation within your UI. For example, you may wish to resize the image. For user avatars, you may wish to make them round, give them a border, etc.

    The ImageProcessingBlock operates in a background thread, and its results get cached in memory (into a configurable NSCache instance).

    Declaration

    Objective-C

    typedef UIImage *_Nonnull (^ZDCImageProcessingBlock)(UIImage *_Nonnull)

    Swift

    typealias ZDCImageProcessingBlock = (UIImage) -> UIImage
  • Reports the results of an upload attempt. If an upload fails the PushManager may still be able to recover.

    Declaration

    Objective-C

    typedef void (^UploadCompletionBlock)(BOOL)

    Swift

    typealias UploadCompletionBlock = (Bool) -> Void
  • Undocumented

    Declaration

    Objective-C

    typedef void(^accountSetupViewCompletionHandler)(NSString *__nullable localUserID,
    																 BOOL completedActivation,
    																 BOOL shouldBackupAccessKey)

    Swift

    typealias accountSetupViewCompletionHandler = (String?, Bool, Bool) -> Void
  • Undocumented

    Declaration

    Objective-C

    typedef void(^SharedUsersViewCompletionHandler)(NSSet<NSString*> *addedUserIDs,
                                                    NSSet<NSString*> *removedUserIDs)

    Swift

    typealias SharedUsersViewCompletionHandler = (Set<String>, Set<String>) -> Void
  • IMPORTANT: If you’re checksuming the entire file/stream: - this block will be called exactly once - when called the done value will be YES, and you’ll either have a non-nil hash, or a non-nil error If you’re checksuming in chunks: - this block may be called multiple times - the very last time this block is called the done value will be YES and the hash will be nil

    Declaration

    Objective-C

    typedef void (^ZDCFileChecksumCallbackBlock)(NSData *_Nullable, uint64_t, BOOL,
                                                 NSError *_Nullable)

    Swift

    typealias ZDCFileChecksumCallbackBlock = (Data?, UInt64, Bool, Error?) -> Void

    Parameters

    hash

    The calculated checksum value. The size of the hash will correspond with the algorithm used.

    chunkIndex

    If a chunkSize is configured, this value will start at zero, and increase with each additional chunk found. If a chunkSize is not configured, this value will be zero.

    done

    If set, this is the last invocation of the callback block you’ll receive. See important note below concerning this value when using chunks.

    error

    If non-nil, then some kind of error occurred with the underlying file/stream. The hash value will be nil and the done value with be YES.