RemovableUserStorage

public protocol RemovableUserStorage : Peripheral

Removable user storage.

This peripheral can be retrieved by:

device.getPeripheral(Peripherals.removableUserStorage)
  • Current state of removable user storage.

    Declaration

    Swift

    var state: RemovableUserStorageState { get }
  • Information about the current media.

    nil if current media is not available.

    Declaration

    Swift

    var mediaInfo: RemovableUserStorageMediaInfo? { get }
  • Available free space on current media, in Bytes. Negative value if not known.

    Declaration

    Swift

    var availableSpace: Int64 { get }
  • Current ability to format the media. ‘true’ if the media can be formatted, otherwise ‘false’

    Declaration

    Swift

    var canFormat: Bool { get }
  • Supported formatting types.

    Declaration

    Swift

    var supportedFormattingTypes: Set<FormattingType> { get }
  • Formatting state.

    Declaration

    Swift

    var formattingState: FormattingState? { get }
  • Requests a format of the media.

    Should be called only when canFormat is true.

    When formatting starts, the current state becomes .formatting.

    The formatting result is indicated with the transient state .formattingSucceeded, .formattingFailed, or .formattingDenied.

    Declaration

    Swift

    func format(formattingType: FormattingType, newMediaName: String) -> Bool

    Parameters

    formattingType

    type of formatting

    newMediaName

    the new name that should be given to the media. If you pass an empty string, the a default name will be assigned.

    Return Value

    true if the format has been asked, false otherwise.

  • Requests a format of the media. The formatted media will get a default name.

    Should be called only when canFormat is true.

    Note

    If you want to set a name, use format(newMediaName:).

    When formatting starts, the current state becomes .formatting.

    The formatting result is indicated with the transient state .formattingSucceeded, .formattingFailed, or .formattingDenied.

    Declaration

    Swift

    func format(formattingType: FormattingType) -> Bool

    Parameters

    formattingType

    type of formatting for the current media

    Return Value

    true if the format has been asked, false otherwise