ConflictResolutionPolicy

public enum ConflictResolutionPolicy

An action to take in the event of a file conflict during saving. A file conflict can occur when attempting to save a file in a directory where another file with the same name already exists.

  • Change the name of the saved file by appending the conflict number to the file name stem until an available name is found. For example, when trying to save a file with the name “image.jpeg”, the file might be saved as “image (1).jpeg”, “image (2).jpeg” and so on.

    Declaration

    Swift

    case rename
  • Overwrite the existing file.

    Declaration

    Swift

    case overwrite
  • Overwrite the existing file only if its hash matches the one provided. If the hashes don’t match, then save the file by appending “{CONFLICTED}” to the file name stem. If the resulting name produces a conflict, begin appending the conflict number to the file name stem until an available name is found. This can be usefil in cases where you want to avoid race conditions in which more than one client tries to modify the content of one file at the same time.

    Declaration

    Swift

    case overwriteFileHashOrRename(UInt64)