StoreOptions

public struct StoreOptions

Create instances of this struct and use its properties for providing additional data regarding paths and files that are managed through the GTStorable protocol.

Instances of this protocol are usually passed as arguments to GTStorable methods.

  • The target directory to use. Default value is documents directory.

    Declaration

    Swift

    public var directory: GTStorableToolkit.Directory
  • One or more subdirectories to be appended to directory. Leave it nil if you don’t want to use any.

    Declaration

    Swift

    public var subDirectory: String?
  • Set a custom file name for files managed by the GTStorable methods.

    By leaving it nil the type of the object adopting the GTStorable protocol is used as the default file name.

    Declaration

    Swift

    public var customFilename: String?
  • Specify a custom extension to files managed by the GTStorable methods.

    Leave it nil to have the file type specify the file extension automatically.

    Declaration

    Swift

    public var customExtension: String?
  • When true the subdirectories specified by the subDirectory property are being created automatically if they don’t exist. Default value is true.

    Declaration

    Swift

    public var createSubDir: Bool
  • An empty initializer. Assign values to properties manually.

    Declaration

    Swift

    public init()
  • Custom initializer which accepts the working directory only as an argument.

    Declaration

    Swift

    public init(withDirectory directory: Directory)
  • Custom initializer which accepts initial values for all properties as arguments.

    Declaration

    Swift

    public init(withDirectory directory: Directory, subDirectory: String? = nil, createDirIfNecessary: Bool, customFilename: String? = nil, customExtension: String? = nil)