Skip to main content

Manage channel tag data

Create and manage tags to organize channels. Each user can create up to 20 tags. Tag data is synced to the Nexconn server.

NCTag properties

PropertyTypeDescription
tagIdNSStringUnique tag identifier (max 10 chars)
tagNameNSStringTag name (max 15 chars)
countNSIntegerNumber of channels in this tag
timestampint64Tag creation timestamp (milliseconds)
tip

This guide covers tag data only. For assigning tags to channels and querying channels by tag, see Set and Use Channel Tags.

Create a tag

Call NCTag.createTag(_:completion:):

swift
import NexconnChatSDK
let params = CreateTagParams(tagId: "tag001", tagName: "Work")
Tag.createTag(params: params) { tag, error in
if let tag {
print("Tag created: \(tag.tagId) (\(tag.tagName))")
} else {
print("Failed: \(error?.localizedDescription ?? "unknown error")")
}
}

Get all tags

swift
import NexconnChatSDK
Tag.getTags { tags, error in
for tag in tags ?? [] {
print("Tag: \(tag.tagId)\(tag.tagName)")
}
}

Remove a tag

swift
import NexconnChatSDK
let tag: Tag? = nil // Replace with a Tag instance from Tag.getTag/getTags
guard let tag else { return }
tag.delete { error in
if error == nil {
print("Tag removed.")
}
}

Update a tag name

swift
import NexconnChatSDK
let tag: Tag? = nil // Replace with a Tag instance from Tag.getTag/getTags
guard let tag else { return }
tag.update(tagName: "Updated Name") { error in
if error == nil {
print("Tag updated.")
}
}