Component Name | Class Name | Function Description |
Gift Selection Panel | GiftListView | Displays the available gifts and manages user selection and send actions. |
Gift Playback Component | GiftPlayView | Receives gift messages and renders corresponding animation effects on screen (such as SVGA animations). |
Gift Panel | Live Comment Gifts | Full-Screen Gifts |
![]() | ![]() | ![]() |
GiftListView and add it to your view:import TUILiveKitclass YourGiftViewController: UIViewController {// 1. Create GiftListView object// - roomId: Must match the roomId of the current live room joined by the audiencelazy var giftListView = {let view = GiftListView(roomId: liveId)return view}()private let liveId: Stringinit(liveId: String) {self.liveId = liveIdsuper.init(nibName: nil, bundle: nil)}required init?(coder: NSCoder) {fatalError("init(coder:) has not been implemented")}// ... other code ...public override func viewDidLoad() {super.viewDidLoad()// 2. Add the component to the view and set up layoutview.addSubview(giftListView)giftListView.snp.remakeConstraints { make inmake.leading.trailing.equalToSuperview()make.height.equalTo(256)make.bottom.equalToSuperview()}}}
GiftPlayView component includes built-in functionality for receiving gift messages and playing gift effects. Use the sample code below to create a GiftPlayView and add it to your view:import TUILiveKit// YourAnchorViewController represents the host's view controller. Audience-side can refer to the following example:class YourAnchorViewController: UIViewController {// 1. Create and initialize GiftPlayView object// - roomId: Must match the roomId of the current live room joined by the audiencelazy var giftPlayView = {let view = GiftPlayView(roomId: liveId)return view}()private let liveId: Stringinit(liveId: String) {self.liveId = liveIdsuper.init(nibName: nil, bundle: nil)}required init?(coder: NSCoder) {fatalError("init(coder:) has not been implemented")}// ... other code ...public override func viewDidLoad() {super.viewDidLoad()// 2. Add the component to the view and set up layoutview.addSubview(giftPlayView)giftPlayView.snp.remakeConstraints { make inmake.edges.equalToSuperview()}}}
フィードバック