ParseAnonymous

public struct ParseAnonymous<AuthenticatedUser> : ParseAuthentication where AuthenticatedUser : ParseUser

Provides utility functions for working with Anonymously logged-in users.

Anonymous users have some unique characteristics:

  • Anonymous users don’t need a user name or password.
  • Once logged out, an anonymous user cannot be recovered.
  • When the current user is anonymous, the following methods can be used to switch to a different user or convert the anonymous user into a regular one:
    • signup converts an anonymous user to a standard user with the given username and password. Data associated with the anonymous user is retained.
    • login switches users without converting the anonymous user. Data associated with the anonymous user will be lost.
    • Service login (e.g. Apple, Facebook, Twitter) will attempt to convert the anonymous user into a standard user by linking it to the service. If a user already exists that is linked to the service, it will instead switch to the existing user.
    • Service linking (e.g. Apple, Facebook, Twitter) will convert the anonymous user into a standard user by linking it to the service.
  • Declaration

    Swift

    public static var __type: String { get }

Login

  • Login a ParseUser synchronously using the respective authentication type.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    func login(options: API.Options = []) throws -> AuthenticatedUser

    Parameters

    options

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

    Return Value

    the linked ParseUser.

  • Login a ParseUser synchronously using the respective authentication type.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    func login(authData: [String: String],
               options: API.Options = []) throws -> AuthenticatedUser

    Parameters

    authData

    The authData for the respective authentication type. This will be ignored.

    options

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

    Return Value

    the linked ParseUser.

  • Login a ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

    func login(options: API.Options = [],
               callbackQueue: DispatchQueue = .main,
               completion: @escaping (Result<AuthenticatedUser, 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.

  • Login a ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

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

    Parameters

    authData

    The authData for the respective authentication type. This will be ignored.

    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.

  • Login a ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    func loginPublisher(options: API.Options = []) -> Future<AuthenticatedUser, ParseError>

    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.

  • Login a ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    func loginPublisher(authData: [String: String],
                        options: API.Options = []) -> Future<AuthenticatedUser, ParseError>

    Parameters

    authData

    The authData for the respective authentication type. This will be ignored.

    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.

Link

  • Unavailable for ParseAnonymous. Will always return an error.

    Declaration

    Swift

    func link(authData: [String: String],
              options: API.Options = [],
              callbackQueue: DispatchQueue = .main,
              completion: @escaping (Result<AuthenticatedUser, ParseError>) -> Void)
  • Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    func linkPublisher(authData: [String: String],
                       options: API.Options = []) -> Future<AuthenticatedUser, ParseError>