# 特性列表 (/zh-CN/realtime-media/rtm/reference/capabilities-and-compatibility/feature-list/swift) > For AI agents: see the complete documentation index at [llms.txt](/llms.txt). 本文提供 RTM 所具备的功能特性及对应 API 接口。 ## Setup [#setup-6] | 功能 | API 接口 | | --- | --- | | 创建实例 | [`AgoraRtmClientKit(_ config: AgoraRtmClientConfig, delegate: (any AgoraRtmClientDelegate)?)`](/zh-CN/api-reference/rtm/ios/configuration#initwithconfig) | | 销毁实例 | [`rtm.destroy() -> AgoraRtmErrorCode`](/zh-CN/api-reference/rtm/ios/configuration#destroy) | | Token 设置 | [`AgoraRtmClientConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmclientconfig) 中的 `token` 参数 | | 端侧加密 | [`AgoraRtmClientConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmclientconfig) 中的 `encryptionConfig` 参数 | | Presence 超时设置 | [`AgoraRtmClientConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmclientconfig) 中的 `presenceTimeout` 参数 | | 日志等级设置 | [`AgoraRtmLogConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmlogconfig) 中的 `level` 参数 | | Proxy 设置 | [`AgoraRtmProxyConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmproxyconfig) 中的 `proxyType`、`server`、`port`、`account`、`password` 参数 | | 消息传输协议设置 | [`AgoraRtmClientConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmclientconfig) 中的 `protocolType` 参数 | | 私有化部署设置 | [`AgoraRtmPrivateConfig`](/zh-CN/api-reference/rtm/ios/configuration#agorartmprivateconfig) 中的 `serviceType`、`accessPointHosts` 参数 | | 事件监听 | [feature-list-swift-html-0-10-1 details](#table-slot-feature-list-swift-html-0-10-1) | | 登录服务 | [`rtm.login(_ token: String?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/configuration#loginbytoken) | | 登出服务 | [`rtm.logout(_ completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/configuration#logout) | **feature-list-swift-html-0-10-1 details** - [`rtm.addDelegate(_ delegate: any AgoraRtmClientDelegate)`](/zh-CN/api-reference/rtm/ios/configuration#添加监听) - [`rtm.removeDelegate(_ delegate: any AgoraRtmClientDelegate)`](/zh-CN/api-reference/rtm/ios/configuration#删除监听) ## Channel [#channel-6] | 功能 | API 接口 | | --- | --- | | 订阅频道 | [`rtm.subscribe(channelName: String, option subscribeOption: AgoraRtmSubscribeOptions?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/channel#subscribewithchannel) | | 取消订阅频道 | [`rtm.unsubscribe(_ channelName: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/channel#unsubscribewithchannel) | | 创建 Stream Channel | [`rtm.createStreamChannel(_ channelName: String) throws -> AgoraRtmStreamChannel`](/zh-CN/api-reference/rtm/ios/channel#createstreamchannel) | | 加入 Stream Channel | [`streamChannel.join(_ option: AgoraRtmJoinChannelOption, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/channel#joinwithoption) | | 离开 Stream Channel | [`streamChannel.leave(_ completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/channel#leave) | | 销毁 Stream Channel | [`streamChannel.destroy() -> AgoraRtmErrorCode`](/zh-CN/api-reference/rtm/ios/channel#destroy) | ## Topic [#topic-6] | 功能 | API 接口 | | --- | --- | | 加入 Topic | [`streamChannel.joinTopic(_ topic: String, option: AgoraRtmJoinTopicOption?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/topic#jointopic) | | 发送 Topic 消息 | [`streamChannel.publishTopicMessage(topic: String, message: String, option options: AgoraRtmTopicMessageOptions?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/topic#publishtopicmessage) | | 离开 Topic | [`streamChannel.leaveTopic(_ topic: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/topic#leavetopic) | | 订阅 Topic | [`streamChannel.subscribeTopic(_ topic: String, option: AgoraRtmTopicOption?, completion completionBlock: AgoraRtmTopicSubscriptionBlock? = nil)`](/zh-CN/api-reference/rtm/ios/topic#subscribetopic) | | 取消订阅 Topic | [`streamChannel.unsubscribeTopic(_ topic: String, option: AgoraRtmTopicOption?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/topic#unsubscribetopic) | ## Message [#message-6] | 功能 | API 接口 | | --- | --- | | 发送消息 | [`[rtm publish:message:option:completion]`](/zh-CN/api-reference/rtm/ios/message#publish) | ## 在线状态 [#在线状态-6] | 功能 | API 接口 | | --- | --- | | 查询用户在线状态 | [`getUserOnlineStatus`](/zh-CN/api-reference/rtm/swift/presence#getUserOnlineStatus) | | 查询频道在线用户 | [`rtm.getPresence()?.whoNow(channelName: String, channelType: AgoraRtmChannelType, options: AgoraRtmPresenceOptions?, completion completionBlock: AgoraRtmWhoNowBlock? = nil)`](/zh-CN/api-reference/rtm/ios/presence#whonow) | | 查询用户所在频道 | [`rtm.getPresence()?.whereNow(userId: String, completion completionBlock: AgoraRtmWhereNowBlock? = nil)`](/zh-CN/api-reference/rtm/ios/presence#wherenow) | | 设置用户临时状态 | [`rtm.getPresence()?.setState(channelName: String, channelType: AgoraRtmChannelType, items: [String: String], completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/presence#setstate) | | 查询用户临时状态 | [`rtm.getPresence()?.getState(channelName: String, channelType: AgoraRtmChannelType, userId: String, completion completionBlock: AgoraRtmPresenceGetStateBlock? = nil)`](/zh-CN/api-reference/rtm/ios/presence#getstate) | | 删除用户临时状态 | [`rtm.getPresence()?.removeState(channelName: String, channelType: AgoraRtmChannelType, keys: [String], completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/presence#removestate) | ## 存储 [#存储-6] | 功能 | API 接口 | | --- | --- | | 设置频道属性 | [`rtm.getStorage()?.setChannelMetadata(channelName: String, channelType: AgoraRtmChannelType, data: AgoraRtmMetadata, options: AgoraRtmMetadataOptions?, lock: String?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#setchannelmetadata) | | 获取频道属性 | [`rtm.getStorage()?.getChannelMetadata(channelName: String, channelType: AgoraRtmChannelType, completion completionBlock: AgoraRtmGetMetadataBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#getchannelmetadata) | | 删除频道属性 | [`rtm.getStorage()?.removeChannelMetadata(channelName: String, channelType: AgoraRtmChannelType, data: AgoraRtmMetadata, options: AgoraRtmMetadataOptions?, lock: String?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#removechannelmetadata) | | 更新频道属性 | [`rtm.getStorage()?.updateChannelMetadata(channelName: String, channelType: AgoraRtmChannelType, data: AgoraRtmMetadata, options: AgoraRtmMetadataOptions?, lock: String?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#updatechannelmetadata) | | 设置用户属性 | [`rtm.getStorage()?.setUserMetadata(userId: String, data: AgoraRtmMetadata, options: AgoraRtmMetadataOptions?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#setusermetadata) | | 获取用户属性 | [`rtm.getStorage()?.getUserMetadata(userId: String, completion completionBlock: AgoraRtmGetMetadataBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#getusermetadata) | | 删除用户属性 | [`rtm.getStorage()?.removeUserMetadata(userId: String, data: AgoraRtmMetadata, options: AgoraRtmMetadataOptions?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#removeusermetadata) | | 更新用户属性 | [`rtm.getStorage()?.updateChannelMetadata(channelName: String, channelType: AgoraRtmChannelType, data: AgoraRtmMetadata, options: AgoraRtmMetadataOptions?, lock: String?, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#setchannelmetadata) | | 订阅用户属性 | [`rtm.getStorage()?.subscribeUserMetadata(userId: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#subscribeusermetadata) | | 取消订阅用户属性 | [`rtm.getStorage()?.unsubscribeUserMetadata(userId: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/storage#unsubscribeusermetadata) | ## 锁 [#锁-6] | 功能 | API 接口 | | --- | --- | | 设置锁 | [`rtm.getLock()?.setLock(channelName: String, channelType: AgoraRtmChannelType, lockName: String, ttl: Int32, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/lock#setlock) | | 获取锁 | [`rtm.getLock()?.acquireLock(channelName: String, channelType: AgoraRtmChannelType, lockName: String, retry: Bool, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/lock#acquirelock) | | 释放锁 | [`rtm.getLock()?.releaseLock(channelName: String, channelType: AgoraRtmChannelType, lockName: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/lock#releaselock) | | 收回锁 | [`rtm.getLock()?.revokeLock(channelName: String, channelType: AgoraRtmChannelType, lockName: String, userId: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/lock#revokelock) | | 查询锁 | [`rtm.getLock()?.getLocks(channelName: String, channelType: AgoraRtmChannelType, completion completionBlock: AgoraRtmGetLocksBlock? = nil)`](/zh-CN/api-reference/rtm/ios/lock#getlocks) | | 删除锁 | [`rtm.getLock()?.removeLock(channelName: String, channelType: AgoraRtmChannelType, lockName: String, completion completionBlock: AgoraRtmOperationBlock? = nil)`](/zh-CN/api-reference/rtm/ios/lock#removelock) |