DBFILESWriteMode

Objective-C

@interface DBFILESWriteMode : NSObject <DBSerializable, NSCopying>

Swift

class DBFILESWriteMode : NSObject, DBSerializable, NSCopying

The WriteMode union.

Your intent when writing a file to some path. This is used to determine what constitutes a conflict and what the autorename strategy is. In some situations, the conflict behavior is identical: (a) If the target path doesn’t refer to anything, the file is always written; no conflict. (b) If the target path refers to a folder, it’s always a conflict. © If the target path refers to a file with identical contents, nothing gets written; no conflict. The conflict checking differs in the case where there’s a file at the target path with contents different from the contents you’re trying to write.

This class implements the DBSerializable protocol (serialize and deserialize instance methods), which is required for all Obj-C SDK API route objects.

Instance fields

  • tag

    Represents the union’s current tag state.

    Declaration

    Objective-C

    @property (nonatomic, readonly) DBFILESWriteModeTag tag;

    Swift

    var tag: DBFILESWriteModeTag { get }
  • Overwrite if the given “rev” matches the existing file’s “rev”. The autorename strategy is to append the string “conflicted copy” to the file name. For example, “document.txt” might become “document (conflicted copy).txt” or “document (Panda’s conflicted copy).txt”. - note: Ensure the isUpdate method returns true before accessing, otherwise a runtime exception will be raised.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull update;

    Swift

    var update: String { get }

Constructors

  • Initializes union class with tag state of “add”.

    Description of the “add” tag state: Do not overwrite an existing file if there is a conflict. The autorename strategy is to append a number to the file name. For example, “document.txt” might become “document (2).txt”.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAdd;

    Swift

    init(add: ())

    Return Value

    An initialized instance.

  • Initializes union class with tag state of “overwrite”.

    Description of the “overwrite” tag state: Always overwrite the existing file. The autorename strategy is the same as it is for add.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithOverwrite;

    Swift

    init(overwrite: ())

    Return Value

    An initialized instance.

  • Initializes union class with tag state of “update”.

    Description of the “update” tag state: Overwrite if the given “rev” matches the existing file’s “rev”. The autorename strategy is to append the string “conflicted copy” to the file name. For example, “document.txt” might become “document (conflicted copy).txt” or “document (Panda’s conflicted copy).txt”.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithUpdate:(nonnull NSString *)update;

    Swift

    init(update: String)

    Parameters

    update

    Overwrite if the given “rev” matches the existing file’s “rev”. The autorename strategy is to append the string “conflicted copy” to the file name. For example, “document.txt” might become “document (conflicted copy).txt” or “document (Panda’s conflicted copy).txt”.

    Return Value

    An initialized instance.

Tag state methods

  • Retrieves whether the union’s current tag state has value “add”.

    Declaration

    Objective-C

    - (BOOL)isAdd;

    Swift

    func isAdd() -> Bool

    Return Value

    Whether the union’s current tag state has value “add”.

  • Retrieves whether the union’s current tag state has value “overwrite”.

    Declaration

    Objective-C

    - (BOOL)isOverwrite;

    Swift

    func isOverwrite() -> Bool

    Return Value

    Whether the union’s current tag state has value “overwrite”.

  • Retrieves whether the union’s current tag state has value “update”.

    Note

    Call this method and ensure it returns true before accessing the update property, otherwise a runtime exception will be thrown.

    Declaration

    Objective-C

    - (BOOL)isUpdate;

    Swift

    func isUpdate() -> Bool

    Return Value

    Whether the union’s current tag state has value “update”.

  • Retrieves string value of union’s current tag state.

    Declaration

    Objective-C

    - (nonnull NSString *)tagName;

    Swift

    func tagName() -> String

    Return Value

    A human-readable string representing the union’s current tag state.