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 byParseAnonymous
or any authentication type that conforms toParseAuthentication
.Declaration
Swift
var authData: [String : [String : String]?]? { get set }
-
apple
Extension methodAn apple
ParseUser
.Declaration
Swift
static var apple: ParseApple<Self> { get }
-
apple
Extension methodAn apple
ParseUser
.Declaration
Swift
var apple: ParseApple<Self> { get }
-
facebook
Extension methodA facebook
ParseUser
.Declaration
Swift
static var facebook: ParseFacebook<Self> { get }
-
facebook
Extension methodAn facebook
ParseUser
.Declaration
Swift
var facebook: ParseFacebook<Self> { get }
-
github
Extension methodA github
ParseUser
.Declaration
Swift
static var github: ParseGitHub<Self> { get }
-
github
Extension methodAn github
ParseUser
.Declaration
Swift
var github: ParseGitHub<Self> { get }
-
google
Extension methodA google
ParseUser
.Declaration
Swift
static var google: ParseGoogle<Self> { get }
-
google
Extension methodAn google
ParseUser
.Declaration
Swift
var google: ParseGoogle<Self> { get }
-
linkedin
Extension methodA linkedin
ParseUser
.Declaration
Swift
static var linkedin: ParseLinkedIn<Self> { get }
-
linkedin
Extension methodAn linkedin
ParseUser
.Declaration
Swift
var linkedin: ParseLinkedIn<Self> { get }
-
twitter
Extension methodA twitter
ParseUser
.Declaration
Swift
static var twitter: ParseTwitter<Self> { get }
-
twitter
Extension methodA twitter
ParseUser
.Declaration
Swift
var twitter: ParseTwitter<Self> { get }
-
anonymous
Extension methodAn anonymous
ParseUser
.Declaration
Swift
static var anonymous: ParseAnonymous<Self> { get }
-
anonymous
Extension methodAn anonymous
ParseUser
.Declaration
Swift
var anonymous: ParseAnonymous<Self> { get }
-
login(_:
Extension method, asynchronousauthData: options: ) 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(_:
Extension method, asynchronousoptions: ) 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(_:
Extension method, asynchronousauthData: options: ) 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
.
-
loginPublisher(_:
Extension methodauthData: options: ) 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(_:
Extension methodoptions: ) 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.
-
linkPublisher(_:
Extension methodauthData: options: ) 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.
-
login(_:
Extension methodauthData: options: ) 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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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 aParseError
. -
login(_:
Extension methodauthData: options: callbackQueue: completion: ) 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>)
.
-
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 theParseUser
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(_:
Extension methodoptions: callbackQueue: completion: ) 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 inoptions
.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(_:
Extension methodauthData: options: ) 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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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 aParseError
. -
link(_:
Extension methodauthData: options: callbackQueue: completion: ) 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 inoptions
.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>)
.
-
signup(username:
Extension method, asynchronouspassword: options: ) 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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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:
Extension method, asynchronouspassword: options: ) 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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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:
Extension method, asynchronousoptions: ) Logs in a
ParseUser
asynchronously with a session token. Returns an instance of the successfully logged inParseUser
. If successful, this saves the session to the keychain, so you can retrieve the currently logged in user using current.Throws
An error of typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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 returnnil
.Throws
An error of typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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:
Extension method, asynchronousoptions: ) 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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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:
Extension method, asynchronoususingPost: options: ) Verifies asynchronously whether the specified password associated with the user account is valid.
Throws
An error of typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.Warning
usePost == true
requires Parse Server > 5.0.0. Othewise you should setuserPost = 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:
Extension method, asynchronousoptions: ) Requests asynchronously a verification email be sent to the specified email address associated with the user account.
Throws
An error of typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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:
Extension method, asynchronousoptions: ) Fetches the
ParseUser
aynchronously with the current data from the server and sets an error if one occurs.Throws
An error of typeParseError
.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 inoptions
.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
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns the fetched
ParseUser
. -
save(ignoringCustomObjectIdConfig:
Extension method, asynchronousoptions: ) Saves the
ParseUser
asynchronously.Throws
An error of typeParseError
.Important
If an object saved has the same objectId as current, it will automatically update the current.Warning
If you are usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of colliidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’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 inoptions
.Declaration
Swift
func save(ignoringCustomObjectIdConfig: Bool = false, options: API.Options = []) async throws -> Self
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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 typeParseError
.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 inoptions
.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 typeParseError
.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 inoptions
.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.
-
signupPublisher(username:
Extension methodpassword: options: ) 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 inoptions
.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 inoptions
.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.
-
loginPublisher(username:
Extension methodpassword: options: ) 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 inoptions
.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.
-
becomePublisher(sessionToken:
Extension methodoptions: ) Logs in a
ParseUser
asynchronously with a session token. Publishes an instance of the successfully logged inParseUser
. 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 inoptions
.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 returnnil
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
passwordResetPublisher(email:
Extension methodoptions: ) 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 inoptions
.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.
-
verifyPasswordPublisher(password:
Extension methodusingPost: options: ) 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 setuserPost = false
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
verificationEmailPublisher(email:
Extension methodoptions: ) 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 inoptions
.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.
-
fetchPublisher(includeKeys:
Extension methodoptions: ) 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 inoptions
.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
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.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.
-
savePublisher(options:
Extension methodignoringCustomObjectIdConfig: ) 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 usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of colliidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’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 inoptions
.Declaration
Swift
func savePublisher(options: API.Options = [], ignoringCustomObjectIdConfig: Bool = false) -> Future<Self, ParseError>
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
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 inoptions
.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 inoptions
.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 inoptions
.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.
-
className
Extension methodDeclaration
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
Extension methodGets the currently logged in user from the Keychain and returns an instance of it.
Warning
Only usecurrent
users on the main thread as as modifications tocurrent
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, returnsnil
. -
sessionToken
Extension methodThe session token for the
ParseUser
.This is set by the server upon successful authentication.
Declaration
Swift
var sessionToken: String? { get }
-
login(username:
Extension methodpassword: options: ) 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 typeParseError
.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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 aParseError
. -
login(username:
Extension methodpassword: options: callbackQueue: completion: ) 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 inoptions
.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>)
. -
become(sessionToken:
Extension methodoptions: ) 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 ofParseError
type.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
become(sessionToken:
Extension methodoptions: callbackQueue: completion: ) 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 inoptions
.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>)
.
-
logout(options:
Extension method) Logs out the currently logged in user in Keychain synchronously.
Throws
An error ofParseError
type.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
logout(options:
Extension methodcallbackQueue: completion: ) 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 returnnil
. This is preferable to usinglogout
, 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 inoptions
.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.
-
passwordReset(email:
Extension methodoptions: ) 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 ofParseError
type.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
passwordReset(email:
Extension methodoptions: callbackQueue: completion: ) 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 inoptions
.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.
-
verifyPassword(password:
Extension methodusingPost: options: callbackQueue: completion: ) 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 inoptions
.Warning
usePost == true
requires Parse Server > 5.0.0. Othewise you should setuserPost = 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.
-
verificationEmail(email:
Extension methodoptions: ) Requests synchronously a verification email be sent to the specified email address associated with the user account.
Throws
An error ofParseError
type.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
verificationEmail(email:
Extension methodoptions: callbackQueue: completion: ) 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 inoptions
.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.
-
signup(username:
Extension methodpassword: options: ) 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 inoptions
.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 ofParseError
type.Note
The default cache policy for this method is.reloadIgnoringLocalCacheData
. If a developer desires a different policy, it should be inserted inoptions
.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.
-
signup(options:
Extension methodcallbackQueue: completion: ) 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 inoptions
.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>)
. -
signup(username:
Extension methodpassword: options: callbackQueue: completion: ) 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 inoptions
.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>)
.
-
fetch(includeKeys:
Extension methodoptions: ) Fetches the
ParseUser
synchronously with the current data from the server and sets an error if one occurs.Throws
An error ofParseError
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 inoptions
.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
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.options
A set of header options sent to the server. Defaults to an empty set.
-
fetch(includeKeys:
Extension methodoptions: callbackQueue: completion: ) 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 inoptions
.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
ParseObject
s. Use["*"]
to include all keys. This is similar toinclude
andincludeAll
forQuery
.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>)
.
-
save(options:
Extension method) Saves the
ParseUser
synchronously and throws an error if there’s an issue.Throws
An error of typeParseError
.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
. -
save(ignoringCustomObjectIdConfig:
Extension methodoptions: ) Saves the
ParseUser
synchronously and throws an error if there’s an issue.Throws
An error of typeParseError
.Important
If an object saved has the same objectId as current, it will automatically update the current.Warning
If you are usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of colliidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’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 inoptions
.Declaration
Swift
public func save(ignoringCustomObjectIdConfig: Bool, options: API.Options = []) throws -> Self
Parameters
ignoringCustomObjectIdConfig
Ignore checking for
objectId
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
environments. Defaults to false.options
A set of header options sent to the server. Defaults to an empty set.
Return Value
Returns saved
ParseUser
. -
save(ignoringCustomObjectIdConfig:
Extension methodoptions: callbackQueue: completion: ) 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 usingParseConfiguration.isAllowingCustomObjectIds = true
and plan to generate all of yourobjectId
‘s on the client-side then you should leaveignoringCustomObjectIdConfig = false
. SettingParseConfiguration.isAllowingCustomObjectIds = true
andignoringCustomObjectIdConfig = true
means the client will generateobjectId
’s and the server will generate anobjectId
only when the client does not provide one. This can increase the probability of colliidingobjectId
’s as the client and serverobjectId
’s may be generated using different algorithms. This can also lead to overwriting ofParseObject
’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 inoptions
.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
whenParseConfiguration.isAllowingCustomObjectIds = true
to allow for mixedobjectId
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>)
. -
create(options:
Extension methodcallbackQueue: completion: ) 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>)
. -
replace(options:
Extension methodcallbackQueue: completion: ) 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>)
.
-
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 ofParseError
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 inoptions
.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.
-
delete(options:
Extension methodcallbackQueue: completion: ) 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 inoptions
.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>)
.