Swift SDK User
This SDK is developed using the Swift programming language. Unlike our existing iOS SDK, we provide integration support with Swift Package Manager (SPM). You can take advantage of Swift's expressive and intuitive nature, enabling you to create sophisticated applications with ease.
Use NetmeraUser
class to send information about your application's users to Netmera in a structured way. Typical place to inform Netmera about application user's attributes is after your users has logged in to your application.
User ID Management: For optimal performance and data integrity, we strongly recommend updating user information at the point of login. Ensure that the same userId value is assigned exclusively to users who log in with the corresponding account credentials. Assigning the same userId to multiple users can lead to data inconsistencies and is not considered a best practice.
Setting Attributes
After you have information about your user, you should create a NetmeraUser
object, set values, then call [Netmera updateUser:]
method like below:
UserId cannot be removed:
userId cannot be removed even if you set nil
to it.
Adding Custom Attributes to User
Before Generating a Custom Profile Attribute
Before generating a custom profile attribute, ensure that it is first defined in the Netmera Panel. Custom attributes must be created and configured within the panel before they can be used. For detailed instructions on setting up custom profile attributes, please refer to the guide: Creating Custom Profile Attributes.
Similar to events, you can generate a custom NetmeraUser
subclass using Netmera Dashboard if the set of built-in attributes is not enough for use case.
Expand Developers section from left menu. Click on Profile Attributes > Create Attribute.
After you click Create Attribute, you will see Name, Label, Description, Data Type and Is Array fields. Fill those fields like the image below
After you click Save, your new attribute will be saved and you will be able to add this attribute to your users.
Generated Code:
For all custom profile attributes, you can find the generated code at the bottom of the 'Profile Attribute' page under the 'Generate Code' section. Be sure to include this generated code in your Netmera Panel under the title Profile Attributes > User Class.
![](https://user.netmera.com/~gitbook/image?url=https%3A%2F%2F2578508252-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F0bOAscrXzPSujyzq8DEz%252Fuploads%252FFumawXNZlu71GDiWOKsn%252Fimage.png%3Falt%3Dmedia%26token%3D4d19dc3f-e0da-4162-82b0-b26e684a42cb&width=768&dpr=4&quality=100&sign=b9689b0&sv=1)
Private info
The sharing of private datas are prohibited under KVKK law. In the profile and event definitions in the application, firstly the user defines the attributes in the Netmera panel. When the Private Information feature is selected while defining, the value of the attribute is not passed to the backend by the Netmera SDK. This check is done on the SDK side (Netmera.update(user)), the request does not go backend.
![](https://user.netmera.com/~gitbook/image?url=https%3A%2F%2F2578508252-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F0bOAscrXzPSujyzq8DEz%252Fuploads%252F5vsLegu042efT2750KvM%252Fimage.png%3Falt%3Dmedia%26token%3D2559c26f-25c8-46ea-a88d-d9e74788eaab&width=768&dpr=4&quality=100&sign=ddc1d3c5&sv=1)
Last updated