Set Contact Attributes in iOS Apps that use SDK Version 10

The process for setting contact attributes has been updated in version 10 of the SDK. To upgrade your app to version 10 of the SDK, first update the initialization code. Then, use this code example to update the contact attribute setting code in your app.

1// Set a single attribute
2SFMCSdk.identity.edit { [self] model in
3  model.addAttribute(key: "FavoriteTeamName", value: "favoriteTeamName")
4  return model
5}
6
7// Set multiple attributes
8SFMCSdk.identity.edit { [self] model in
9  model.addAttributes(attributes: ["FavoriteTeamName": "favoriteTeamName"])
10  return model
11}
12
13// Clear a single attribute
14SFMCSdk.identity.edit { [self] model in
15  model.clearAttribute(key: "AttributeKey")
16  return model
17}
18
19// Clear multiple attributes
20SFMCSdk.identity.edit { [self] model in
21  model.clearAttributes(attributes: ["AttributeKey1", "AttributeKey2"])
22  return model
23}
24
25// Get all attributes
26let attributes = SFMCSdk.identity.get()?.attributes