lytics / ios-sdk

MIT License
0 stars 0 forks source link

Add getProfile Method #90

Closed mgacy closed 1 year ago

mgacy commented 1 year ago

Adds Lytics.getProfile(_:) method and LyticsUser.profile member. The method uses the table name defined in the configuration. Standard usage would look like:

do {
    let user = try await Lytics.shared.getProfile()
} catch {
    // handle error
}

To use an identifier other than primaryIdentityKey it would look like:

let identifier = EntityIdentifier(
    name: "email",
    value: "e@mail.com")

let user = try await Lytics.shared.getProfile(identifier)

This also uses Lytics.getProfile(_:) to populate the ProfileView in the demo app and adds support for displaying an alert in case of a request error.

Closes #81 Closes #83 Closes #84