Instance Property


A Boolean value that indicates whether the credential has a password.


var hasPassword: Bool { get }


This value is true if the receiver has a password, false otherwise.

This method does not attempt to retrieve the password.

If this credential's password is stored in the user’s keychain, password may return nil even if this method returns true—getting the password may fail, or the user may refuse access.

See Also

Getting Credential Properties

var user: String?

The credential’s user name.

var certificates: [Any]

The intermediate certificates of the credential, if it is a client certificate credential.

var password: String?

The credential’s password.

var identity: SecIdentity?

The identity of this credential if it is a client certificate credential.

var persistence: URLCredential.Persistence

The credential’s persistence setting.

enum URLCredential.Persistence

Constants that specify how long the credential will be kept.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software