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, type: ImporterInputRequestType, completion: @escaping (String) -> Bool)
Parameters
name
name of the input required
type
type of the input requested
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
Declaration
Swift
func error(_: Error, completion: @escaping () -> Void)
Parameters
error
The error which occured. Display the localized description to the user
completion
completion handler to call when the user has acknowledged the error