Swift UI example

Is there any swiftUi based UiKit example which i can refer to ? I could find only storyboard implementations.

Hi, @shraavan_hebbar

There is no official sample in SwiftUI currently.

Thanks,

Hi @shraavan_hebbar,

I’ve got some initial SwiftUI + Sendbird UIKit code up and running. Let me know if there’s particular components you need help with until I can get a write up posted.

In the meantime, here’s an example of how to spin up a specific group chat channel if the channel url is passed in:

import SwiftUI
import SendBirdUIKit

struct ChannelView: View {
    
    let channelUrl : String
    
    var body: some View {
        SendbirdChannelContainer(channelUrl: channelUrl)
    }
}

struct SendbirdChannelContainer : UIViewControllerRepresentable {
    func makeUIViewController(context: Context) -> SBUChannelViewController {
        return SBUChannelViewController(channelUrl: channelUrl)
    }
    
    func updateUIViewController(_ uiViewController: SBUChannelViewController, context: Context) {
        ...
    }
    
    
    typealias UIViewControllerType = SBUChannelViewController
    let channelUrl : String
    
}