ImporterDelegate

public protocol ImporterDelegate : AnyObject

Protocol of the delegate of an Importer

  • Request for a user input in form of a text, which is required for the importer to operate

    Declaration

    Swift

    func requestInput(name: String, suggestions: [String], isSecret: Bool, completion: @escaping (String) -> Bool)

    Parameters

    name

    name of the input required

    suggestions

    suggestions for the input - may be empty

    isSecret

    if the requested input is considered a secret, e.g. to show a password type input field

    completion

    function to pass input to. Returns if the input was accepted. In case an input was not accepted, please call the function again.

  • Request to save a credential

    Importers which require authenticate can for example save tokens this way. Make sure to properly encrypt the storage.

    It is not strictly required, you can just do nothing in this method.

    Declaration

    Swift

    func saveCredential(_ value: String, for key: String)

    Parameters

    value

    value to save

    key

    key to retreive the value. Importers are required to ensure the uniqueness.

  • Request for a saved credential

    It is not strictly required, you can just always return nil.

    Parameter: key: key used to save the value Returns: String with the value or nil if no value can be found

    Declaration

    Swift

    func readCredential(_ key: String) -> String?
  • Request a view to show / operate in Returns: UIView?

  • Request a view to show / operate in Returns: NSView?

    Declaration

    Swift

    func view() -> NSView?
  • Request to remove the previously requested view from the screen

    Declaration

    Swift

    func removeView()
  • Indicates an error occured

    Parameter: error: The error which occured. Display the localized description to the user

    Declaration

    Swift

    func error(_: Error)