ParseUser

public protocol ParseUser : ParseObject

Objects that conform to the ParseUser protocol have a local representation of a user persisted to the Parse Data. This protocol inherits from the ParseObject protocol, and retains the same functionality of a ParseObject, but also extends it with various user specific methods, like authentication, signing up, and validation uniqueness.

  • The username for the ParseUser.

    Declaration

    Swift

    var username: String? { get set }
  • The email for the ParseUser.

    Declaration

    Swift

    var email: String? { get set }
  • Determines if the email is verified for the ParseUser.

    Note

    This value can only be changed on the Parse Server.

    Declaration

    Swift

    var emailVerified: Bool? { get }
  • The password for the ParseUser.

    This will not be filled in from the server with the password. It is only meant to be set.

    Declaration

    Swift

    var password: String? { get set }
  • The authentication data for the ParseUser. Used by ParseAnonymous or any authentication type that conforms to ParseAuthentication.

    Declaration

    Swift

    var authData: [String : [String : String]?]? { get set }

3rd Party Authentication - ParseApple

  • apple Extension method

    An apple ParseUser.

    Declaration

    Swift

    static var apple: ParseApple<Self> { get }
  • apple Extension method

    An apple ParseUser.

    Declaration

    Swift

    var apple: ParseApple<Self> { get }

3rd Party Authentication - ParseFacebook

  • facebook Extension method

    A facebook ParseUser.

    Declaration

    Swift

    static var facebook: ParseFacebook<Self> { get }
  • facebook Extension method

    An facebook ParseUser.

    Declaration

    Swift

    var facebook: ParseFacebook<Self> { get }

3rd Party Authentication - ParseGitHub

  • github Extension method

    A github ParseUser.

    Declaration

    Swift

    static var github: ParseGitHub<Self> { get }
  • github Extension method

    An github ParseUser.

    Declaration

    Swift

    var github: ParseGitHub<Self> { get }

3rd Party Authentication - ParseGoogle

  • google Extension method

    A google ParseUser.

    Declaration

    Swift

    static var google: ParseGoogle<Self> { get }
  • google Extension method

    An google ParseUser.

    Declaration

    Swift

    var google: ParseGoogle<Self> { get }

3rd Party Authentication - ParseLDAP

  • ldap Extension method

    An ldap ParseUser.

    Declaration

    Swift

    static var ldap: ParseLDAP<Self> { get }
  • ldap Extension method

    An ldap ParseUser.

    Declaration

    Swift

    var ldap: ParseLDAP<Self> { get }

3rd Party Authentication - ParseLinkedIn

  • linkedin Extension method

    A linkedin ParseUser.

    Declaration

    Swift

    static var linkedin: ParseLinkedIn<Self> { get }
  • linkedin Extension method

    An linkedin ParseUser.

    Declaration

    Swift

    var linkedin: ParseLinkedIn<Self> { get }

3rd Party Authentication - ParseTwitter

  • twitter Extension method

    A twitter ParseUser.

    Declaration

    Swift

    static var twitter: ParseTwitter<Self> { get }
  • twitter Extension method

    A twitterParseUser.

    Declaration

    Swift

    var twitter: ParseTwitter<Self> { get }

ParseAnonymous

  • anonymous Extension method

    An anonymous ParseUser.

    Declaration

    Swift

    static var anonymous: ParseAnonymous<Self> { get }
  • anonymous Extension method

    An anonymous ParseUser.

    Declaration

    Swift

    var anonymous: ParseAnonymous<Self> { get }

3rd Party Authentication - Login Async/Await

  • login(_:authData:options:) Extension method, asynchronous

    Makes an asynchronous request to log in a user with specified credentials. Returns an instance of the successfully logged in ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Declaration

    Swift

    static func login(_ type: String,
                      authData: [String: String],
                      options: API.Options = []) async throws -> Self

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    An instance of the logged in ParseUser.

  • unlink(_:options:) Extension method, asynchronous

    Unlink the authentication type asynchronously.

    Declaration

    Swift

    func unlink(_ type: String,
                options: API.Options = []) async throws -> Self

    Parameters

    type

    The type to unlink. The user must be logged in on this device.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    An instance of the logged in ParseUser.

  • link(_:authData:options:) Extension method, asynchronous

    Makes an asynchronous request to link a user with specified credentials. The user should already be logged in. Returns an instance of the successfully linked ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Declaration

    Swift

    static func link(_ type: String,
                     authData: [String: String],
                     options: API.Options = []) async throws -> Self

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    An instance of the logged in ParseUser.

3rd Party Authentication - Login Combine

  • Makes an asynchronous request to log in a user with specified credentials. Publishes an instance of the successfully logged in ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Declaration

    Swift

    static func loginPublisher(_ type: String,
                               authData: [String: String],
                               options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • unlinkPublisher(_:options:) Extension method

    Unlink the authentication type asynchronously. Publishes when complete.

    Declaration

    Swift

    func unlinkPublisher(_ type: String,
                         options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    type

    The type to unlink. The user must be logged in on this device.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Makes an asynchronous request to link a user with specified credentials. The user should already be logged in. Publishes an instance of the successfully linked ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Declaration

    Swift

    static func linkPublisher(_ type: String,
                              authData: [String: String],
                              options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

3rd Party Authentication - Login

  • login(_:authData:options:) Extension method

    Makes a synchronous request to login a user with specified credentials.

    Returns an instance of the successfully logged in ParseUser. This also caches the user locally so that calls to current will use the latest logged in user.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func login(_ type: String,
                      authData: [String: String],
                      options: API.Options) throws -> Self

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication. See supported 3rd party authentications for more information.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    An instance of the logged in ParseUser. If login failed due to either an incorrect password or incorrect username, it throws a ParseError.

  • Makes an asynchronous request to log in a user with specified credentials. Returns an instance of the successfully logged in ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Declaration

    Swift

    static func login(_ type: String,
                      authData: [String: String],
                      options: API.Options,
                      callbackQueue: DispatchQueue = .main,
                      completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication. See supported 3rd party authentications for more information.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

3rd Party Authentication - Link

  • isLinked(with:) Extension method

    Whether the ParseUser is logged in with the respective authentication string type.

    Declaration

    Swift

    func isLinked(with type: String) -> Bool

    Parameters

    type

    The authentication type to check. The user must be logged in on this device.

    Return Value

    true if the ParseUser is logged in via the repective authentication type. false if the user is not.

  • strip(_:) Extension method

    Strips the current user of a respective authentication type.

    Declaration

    Swift

    func strip(_ type: String) -> Self

    Parameters

    type

    The authentication type to strip.

    Return Value

    The user whose autentication type was stripped.

  • Unlink the authentication type asynchronously.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func unlink(_ type: String,
                options: API.Options = [],
                callbackQueue: DispatchQueue = .main,
                completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    type

    The type to unlink. The user must be logged in on this device.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • link(_:authData:options:) Extension method

    Makes a synchronous request to link a user with specified credentials. The user should already be logged in.

    Returns an instance of the successfully linked ParseUser. This also caches the user locally so that calls to current will use the latest logged in user.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func link(_ type: String,
                     authData: [String: String],
                     options: API.Options) throws -> Self

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication. See supported 3rd party authentications for more information.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    An instance of the logged in ParseUser. If login failed due to either an incorrect password or incorrect username, it throws a ParseError.

  • Makes an asynchronous request to link a user with specified credentials. The user should already be logged in. Returns an instance of the successfully linked ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func link(_ type: String,
                     authData: [String: String],
                     options: API.Options = [],
                     callbackQueue: DispatchQueue = .main,
                     completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    type

    The authentication type.

    authData

    The data that represents the authentication. See supported 3rd party authentications for more information.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

Async/Await

  • signup(username:password:options:) Extension method, asynchronous

    Signs up the user asynchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func signup(username: String,
                       password: String,
                       options: API.Options = []) async throws -> Self

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the signed in ParseUser.

  • signup(options:) Extension method, asynchronous

    Signs up the user asynchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func signup(options: API.Options = []) async throws -> Self

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the signed in ParseUser.

  • login(username:password:options:) Extension method, asynchronous

    Makes an asynchronous request to log in a user with specified credentials. Returns an instance of the successfully logged in ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func login(username: String,
                      password: String,
                      options: API.Options = []) async throws -> Self

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the logged in ParseUser.

  • become(sessionToken:options:) Extension method, asynchronous

    Logs in a ParseUser asynchronously with a session token. Returns an instance of the successfully logged in ParseUser. If successful, this saves the session to the keychain, so you can retrieve the currently logged in user using current.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func become(sessionToken: String,
                options: API.Options = []) async throws -> Self

    Parameters

    sessionToken

    The sessionToken of the user to login.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the logged in ParseUser.

  • logout(options:) Extension method, asynchronous

    Logs out the currently logged in user asynchronously.

    This will also remove the session from the Keychain, log out of linked services and all future calls to current will return nil.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func logout(options: API.Options = []) async throws

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

  • passwordReset(email:options:) Extension method, asynchronous

    Requests asynchronously a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the web.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func passwordReset(email: String,
                              options: API.Options = []) async throws

    Parameters

    email

    The email address associated with the user that forgot their password.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • verifyPassword(password:usingPost:options:) Extension method, asynchronous

    Verifies asynchronously whether the specified password associated with the user account is valid.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Warning

    usePost == true requires Parse Server > 5.0.0. Othewise you should set userPost = false.

    Declaration

    Swift

    static func verifyPassword(password: String,
                               usingPost: Bool = true,
                               options: API.Options = []) async throws -> Self

    Parameters

    password

    The password to be verified.

    usingPost

    Set to true to use POST for sending. Will use GET otherwise. Defaults to true.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • verificationEmail(email:options:) Extension method, asynchronous

    Requests asynchronously a verification email be sent to the specified email address associated with the user account.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func verificationEmail(email: String,
                                  options: API.Options = []) async throws

    Parameters

    email

    The email address associated with the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • fetch(includeKeys:options:) Extension method, asynchronous

    Fetches the ParseUser aynchronously with the current data from the server and sets an error if one occurs.

    Throws

    An error of type ParseError.

    Important

    If an object fetched has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func fetch(includeKeys: [String]? = nil,
               options: API.Options = []) async throws -> Self

    Parameters

    includeKeys

    The name(s) of the key(s) to include that are ParseObjects. Use ["*"] to include all keys. This is similar to include and includeAll for Query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the fetched ParseUser.

  • save(ignoringCustomObjectIdConfig:options:) Extension method, asynchronous

    Saves the ParseUser asynchronously.

    Throws

    An error of type ParseError.

    Important

    If an object saved has the same objectId as current, it will automatically update the current.

    Warning

    If you are using ParseConfiguration.isAllowingCustomObjectIds = true and plan to generate all of your objectId‘s on the client-side then you should leave ignoringCustomObjectIdConfig = false. Setting ParseConfiguration.isAllowingCustomObjectIds = true and ignoringCustomObjectIdConfig = true means the client will generate objectId’s and the server will generate an objectId only when the client does not provide one. This can increase the probability of colliiding objectId’s as the client and server objectId’s may be generated using different algorithms. This can also lead to overwriting of ParseObject’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func save(ignoringCustomObjectIdConfig: Bool = false,
              options: API.Options = []) async throws -> Self

    Parameters

    ignoringCustomObjectIdConfig

    Ignore checking for objectId when ParseConfiguration.isAllowingCustomObjectIds = true to allow for mixed objectId environments. Defaults to false.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the saved ParseUser.

  • create(options:) Extension method, asynchronous

    Creates the ParseUser asynchronously.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func create(options: API.Options = []) async throws -> Self

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the saved ParseUser.

  • replace(options:) Extension method, asynchronous

    Replaces the ParseUser asynchronously.

    Throws

    An error of type ParseError.

    Important

    If an object replaced has the same objectId as current, it will automatically replace the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func replace(options: API.Options = []) async throws -> Self

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the saved ParseUser.

  • delete(options:) Extension method, asynchronous

    Deletes the ParseUser asynchronously.

    Throws

    An error of type ParseError.

    Important

    If an object deleted has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func delete(options: API.Options = []) async throws

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

Combine

  • Signs up the user asynchronously and publishes value.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func signupPublisher(username: String,
                                password: String,
                                options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • signupPublisher(options:) Extension method

    Signs up the user asynchronously and publishes value.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func signupPublisher(options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Makes an asynchronous request to log in a user with specified credentials. Publishes an instance of the successfully logged in ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func loginPublisher(username: String,
                               password: String,
                               options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Logs in a ParseUser asynchronously with a session token. Publishes an instance of the successfully logged in ParseUser. If successful, this saves the session to the keychain, so you can retrieve the currently logged in user using current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func becomePublisher(sessionToken: String, options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    sessionToken

    The sessionToken of the user to login.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • logoutPublisher(options:) Extension method

    Logs out the currently logged in user asynchronously. Publishes when complete.

    This will also remove the session from the Keychain, log out of linked services and all future calls to current will return nil.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func logoutPublisher(options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Requests asynchronously a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the web. Publishes when complete.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func passwordResetPublisher(email: String,
                                       options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    email

    The email address associated with the user that forgot their password.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Verifies asynchronously whether the specified password associated with the user account is valid. Publishes when complete.

    Warning

    usePost == true requires Parse Server > 5.0.0. Othewise you should set userPost = false.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func verifyPasswordPublisher(password: String,
                                        usingPost: Bool = true,
                                        options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    password

    The password to be verified.

    usingPost

    Set to true to use POST for sending. Will use GET otherwise. Defaults to true.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Requests asynchronously a verification email be sent to the specified email address associated with the user account. Publishes when complete.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    static func verificationEmailPublisher(email: String,
                                           options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    email

    The email address associated with the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Fetches the ParseUser aynchronously with the current data from the server and sets an error if one occurs. Publishes when complete.

    Important

    If an object fetched has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func fetchPublisher(includeKeys: [String]? = nil,
                        options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    includeKeys

    The name(s) of the key(s) to include that are ParseObjects. Use ["*"] to include all keys. This is similar to include and includeAll for Query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Saves the ParseUser asynchronously and publishes when complete.

    Important

    If an object saved has the same objectId as current, it will automatically update the current.

    Warning

    If you are using ParseConfiguration.isAllowingCustomObjectIds = true and plan to generate all of your objectId‘s on the client-side then you should leave ignoringCustomObjectIdConfig = false. Setting ParseConfiguration.isAllowingCustomObjectIds = true and ignoringCustomObjectIdConfig = true means the client will generate objectId’s and the server will generate an objectId only when the client does not provide one. This can increase the probability of colliiding objectId’s as the client and server objectId’s may be generated using different algorithms. This can also lead to overwriting of ParseObject’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func savePublisher(options: API.Options = [],
                       ignoringCustomObjectIdConfig: Bool = false) -> Future<Self, ParseError>

    Parameters

    ignoringCustomObjectIdConfig

    Ignore checking for objectId when ParseConfiguration.isAllowingCustomObjectIds = true to allow for mixed objectId environments. Defaults to false.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • createPublisher(options:) Extension method

    Creates the ParseUser asynchronously and publishes when complete.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func createPublisher(options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • replacePublisher(options:) Extension method

    Replaces the ParseUser asynchronously and publishes when complete.

    Important

    If an object replaced has the same objectId as current, it will automatically replace the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func replacePublisher(options: API.Options = []) -> Future<Self, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • deletePublisher(options:) Extension method

    Deletes the ParseUser asynchronously and publishes when complete.

    Important

    If an object deleted has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    func deletePublisher(options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

Default Implementations

  • className Extension method

    Declaration

    Swift

    static var className: String { get }
  • mergeParse(with:) Extension method

    Declaration

    Swift

    func mergeParse(with object: Self) throws -> Self
  • merge(with:) Extension method

    Declaration

    Swift

    func merge(with object: Self) throws -> Self

Current User Support

  • current Extension method

    Gets the currently logged in user from the Keychain and returns an instance of it.

    Warning

    Only use current users on the main thread as as modifications to current have to be unique.

    Declaration

    Swift

    internal(set) static var current: Self? { get set }

    Return Value

    Returns a ParseUser that is the currently logged in user. If there is none, returns nil.

  • sessionToken Extension method

    The session token for the ParseUser.

    This is set by the server upon successful authentication.

    Declaration

    Swift

    var sessionToken: String? { get }

Logging In

  • Makes a synchronous request to login a user with specified credentials.

    Returns an instance of the successfully logged in ParseUser. This also caches the user locally so that calls to current will use the latest logged in user.

    Throws

    An error of type ParseError.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func login(username: String,
                             password: String, options: API.Options = []) throws -> Self

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    An instance of the logged in ParseUser. If login failed due to either an incorrect password or incorrect username, it throws a ParseError.

  • Makes an asynchronous request to log in a user with specified credentials. Returns an instance of the successfully logged in ParseUser.

    This also caches the user locally so that calls to current will use the latest logged in user.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func login(
        username: String,
        password: String,
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Self, ParseError>) -> Void
    )

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • Logs in a ParseUser synchronously with a session token. On success, this saves the session to the keychain, so you can retrieve the currently logged in user using current.

    Throws

    An Error of ParseError type.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func become(sessionToken: String, options: API.Options = []) throws -> Self

    Parameters

    sessionToken

    The sessionToken of the user to login.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • Logs in a ParseUser asynchronously with a session token. On success, this saves the session to the keychain, so you can retrieve the currently logged in user using current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func become(sessionToken: String,
                       options: API.Options = [],
                       callbackQueue: DispatchQueue = .main,
                       completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    sessionToken

    The sessionToken of the user to login.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute when completed. It should have the following argument signature: (Result<Self, ParseError>).

Logging Out

  • logout(options:) Extension method

    Logs out the currently logged in user in Keychain synchronously.

    Throws

    An error of ParseError type.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func logout(options: API.Options = []) throws

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

  • Logs out the currently logged in user asynchronously.

    This will also remove the session from the Keychain, log out of linked services and all future calls to current will return nil. This is preferable to using logout, unless your code is already running from a background thread.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func logout(options: API.Options = [], callbackQueue: DispatchQueue = .main,
                              completion: @escaping (Result<Void, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when logging out completes or fails.

Password Reset

  • Requests synchronously a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the web.

    Throws

    An error of ParseError type.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func passwordReset(email: String, options: API.Options = []) throws

    Parameters

    email

    The email address associated with the user that forgot their password.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • Requests asynchronously a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the web.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func passwordReset(email: String, options: API.Options = [],
                                     callbackQueue: DispatchQueue = .main,
                                     completion: @escaping (Result<Void, ParseError>) -> Void)

    Parameters

    email

    The email address associated with the user that forgot their password.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when the password reset completes or fails.

Verify Password

  • Verifies asynchronously whether the specified password associated with the user account is valid.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Warning

    usePost == true requires Parse Server > 5.0.0. Othewise you should set userPost = false.

    Declaration

    Swift

    public static func verifyPassword(password: String,
                                      usingPost: Bool = true,
                                      options: API.Options = [],
                                      callbackQueue: DispatchQueue = .main,
                                      completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    password

    The password to be verified.

    usingPost

    Set to true to use POST for sending. Will use GET otherwise. Defaults to true.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when the verification request completes or fails.

Verification Email Request

  • Requests synchronously a verification email be sent to the specified email address associated with the user account.

    Throws

    An error of ParseError type.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func verificationEmail(email: String,
                                         options: API.Options = []) throws

    Parameters

    email

    The email address associated with the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • Requests asynchronously a verification email be sent to the specified email address associated with the user account.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func verificationEmail(email: String,
                                         options: API.Options = [],
                                         callbackQueue: DispatchQueue = .main,
                                         completion: @escaping (Result<Void, ParseError>) -> Void)

    Parameters

    email

    The email address associated with the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when the verification request completes or fails.

Signing Up

  • Signs up the user synchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func signup(username: String,
                              password: String,
                              options: API.Options = []) throws -> Self

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns whether the sign up was successful.

  • signup(options:) Extension method

    Signs up the user synchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Throws

    An error of ParseError type.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func signup(options: API.Options = []) throws -> Self

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns whether the sign up was successful.

  • Signs up the user asynchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func signup(options: API.Options = [], callbackQueue: DispatchQueue = .main,
                       completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • Signs up the user asynchronously.

    This will also enforce that the username isn’t already taken.

    Warning

    Make sure that password and username are set before calling this method.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public static func signup(
        username: String,
        password: String,
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Self, ParseError>) -> Void)

    Parameters

    username

    The username of the user.

    password

    The password of the user.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

Fetchable

  • fetch(includeKeys:options:) Extension method

    Fetches the ParseUser synchronously with the current data from the server and sets an error if one occurs.

    Throws

    An error of ParseError type.

    Important

    If an object fetched has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func fetch(includeKeys: [String]? = nil,
                      options: API.Options = []) throws -> Self

    Parameters

    includeKeys

    The name(s) of the key(s) to include that are ParseObjects. Use ["*"] to include all keys. This is similar to include and includeAll for Query.

    options

    A set of header options sent to the server. Defaults to an empty set.

  • Fetches the ParseUser asynchronously and executes the given callback block.

    Important

    If an object fetched has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func fetch(
        includeKeys: [String]? = nil,
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Self, ParseError>) -> Void
    )

    Parameters

    includeKeys

    The name(s) of the key(s) to include that are ParseObjects. Use ["*"] to include all keys. This is similar to include and includeAll for Query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute when completed. It should have the following argument signature: (Result<Self, ParseError>).

Savable

  • save(options:) Extension method

    Saves the ParseUser synchronously and throws an error if there’s an issue.

    Throws

    An error of type ParseError.

    Important

    If an object saved has the same objectId as current, it will automatically update the current.

    Declaration

    Swift

    public func save(options: API.Options = []) throws -> Self

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns saved ParseUser.

  • Saves the ParseUser synchronously and throws an error if there’s an issue.

    Throws

    An error of type ParseError.

    Important

    If an object saved has the same objectId as current, it will automatically update the current.

    Warning

    If you are using ParseConfiguration.isAllowingCustomObjectIds = true and plan to generate all of your objectId‘s on the client-side then you should leave ignoringCustomObjectIdConfig = false. Setting ParseConfiguration.isAllowingCustomObjectIds = true and ignoringCustomObjectIdConfig = true means the client will generate objectId’s and the server will generate an objectId only when the client does not provide one. This can increase the probability of colliiding objectId’s as the client and server objectId’s may be generated using different algorithms. This can also lead to overwriting of ParseObject’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func save(ignoringCustomObjectIdConfig: Bool,
                     options: API.Options = []) throws -> Self

    Parameters

    ignoringCustomObjectIdConfig

    Ignore checking for objectId when ParseConfiguration.isAllowingCustomObjectIds = true to allow for mixed objectId environments. Defaults to false.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns saved ParseUser.

  • Saves the ParseUser asynchronously and executes the given callback block.

    Important

    If an object saved has the same objectId as current, it will automatically update the current.

    Warning

    If you are using ParseConfiguration.isAllowingCustomObjectIds = true and plan to generate all of your objectId‘s on the client-side then you should leave ignoringCustomObjectIdConfig = false. Setting ParseConfiguration.isAllowingCustomObjectIds = true and ignoringCustomObjectIdConfig = true means the client will generate objectId’s and the server will generate an objectId only when the client does not provide one. This can increase the probability of colliiding objectId’s as the client and server objectId’s may be generated using different algorithms. This can also lead to overwriting of ParseObject’s by accident as the client-side checks are disabled. Developers are responsible for handling such cases.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func save(
        ignoringCustomObjectIdConfig: Bool = false,
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Self, ParseError>) -> Void
    )

    Parameters

    ignoringCustomObjectIdConfig

    Ignore checking for objectId when ParseConfiguration.isAllowingCustomObjectIds = true to allow for mixed objectId environments. Defaults to false.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • Creates the ParseUser asynchronously and executes the given callback block.

    Declaration

    Swift

    public func create(
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Self, ParseError>) -> Void
    )

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • Replaces the ParseUser asynchronously and executes the given callback block.

    Important

    If an object replaced has the same objectId as current, it will automatically replace the current.

    Declaration

    Swift

    public func replace(
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Self, ParseError>) -> Void
    )

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

Deletable

  • delete(options:) Extension method

    Deletes the ParseUser synchronously with the current data from the server and sets an error if one occurs.

    Throws

    An error of ParseError type.

    Important

    If an object deleted has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func delete(options: API.Options = []) throws

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

  • Deletes the ParseUser asynchronously and executes the given callback block.

    Important

    If an object deleted has the same objectId as current, it will automatically update the current.

    Note

    The default cache policy for this method is .reloadIgnoringLocalCacheData. If a developer desires a different policy, it should be inserted in options.

    Declaration

    Swift

    public func delete(
        options: API.Options = [],
        callbackQueue: DispatchQueue = .main,
        completion: @escaping (Result<Void, ParseError>) -> Void
    )

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute when completed. It should have the following argument signature: (Result<Void, ParseError>).