Structure
WFUser
public struct WFUser
Relationships
Conforms To
Decodable
Initializers
init(token:username:)
public init(token: String, username: String?)
Creates a minimum WFUser
object from a stored token.
Use this when the client has already logged in a user and only needs to reconstruct the type from saved properties.
Parameters
Name | Type | Description |
---|---|---|
token | String |
The user's access token |
username | String? |
The user's username (optional) |
init(from:)
public init(from decoder: Decoder) throws
Creates a WFUser
object from the server response.
Primarily used by the WFClient
to create a WFUser
object from the JSON returned by the server.
Parameters
Name | Type | Description |
---|---|---|
decoder | Decoder |
The decoder to use for translating the server response to a Swift object. |
Throws
Error thrown by the try
attempt when decoding any given property.
Properties
token
public var token: String
username
public var username: String?
email
public var email: String?
createdDate
public var createdDate: Date?