Xulo Docs

iOS SDK

Identity and tags

Log a person in with your own user id, log them out, and write tags.

iOS SDK 0.1.4 View as Markdown

Log in

Swift
await Xulo.login(externalId: "USER_ID")

login takes the id your app already uses, as text. All installs that log in with the same External ID belong to one person. The first login keeps the tags the anonymous person already had.

A blank value does not log the device out.

Log out

Swift
await Xulo.logout()

logout removes the External ID from this install and starts a new anonymous person on it. The Subscription ID and the push token stay. The person's other installs are not touched.

Read the ids

Swift
let install = Xulo.subscriptionId // this install
let person = Xulo.xuloId          // this person, once registered

Xulo.subscriptionId stays the same when the token refreshes and when the person logs out. See People and devices.

Write tags

Swift
Xulo.setTags(["plan": "pro"])
Xulo.addTag(key: "summary", value: "1")
  • setTags replaces the tags this install sends.
  • addTag writes one key and keeps the others.
  • "0" is a value, not a delete.
  • Keys that arrive overwrite the stored value. Keys that do not arrive stay.
  • An install sends at most 30 tags.

Tags belong to the person, so every install of that person reads them. See Tags.