Contents

init(user:password:persistence:)

Creates a URL credential instance initialized with a given user name and password, using a given persistence setting.

Declaration

init(user: String, password: String, persistence: URLCredential.Persistence)

Parameters

  • user:

    The user for the credential.

  • password:

    The password for user.

  • persistence:

    A Persistence Swift.enum value indicating whether the credential should be stored permanently, for the duration of the current session, or not at all.

Return Value

An instance of URLCredential, initialized with user name user, password password, and using persistence setting persistence.

Discussion

If persistence is URLCredential.Persistence.permanent, the credential is stored in the keychain. If persistence is URLCredential.Persistence.synchronizable, it is also stored to the user’s other devices.

See Also

Creating a credential