hello, is there a way to import swift class that h...
# swift-export
m
hello, is there a way to import swift class that has observable propreties and be able to observe their changes in the kotlin ios code ? example swift code in thread.
@objc class RoomViewModel:NSObject, ObservableObject { @objc @Published var remoteParticipants: [RemoteParticipant] = [] @objc @Published var connectionState: ConnectionState = .disconnected private var room: Room? // Store cancellables to prevent them from being deallocated private var cancellables = Set<AnyCancellable>() override *init*() { super.init() // Observe remote participants changes $remoteParticipants .sink { [weak self] participants in print("collected remote participants: \(participants.count)") } .store(in: &cancellables) // Observe connection state changes $connectionState .sink { [weak self] state in print("collected connection state: \(state)") } .store(in: &cancellables) setupRoom() } @objc private func setupRoom() { room = Room() guard let room = room else { return } room.add(delegate: self) } @objc func connect(url: String, token: String) async { guard let room = room else { return } do { try await room.connect(url: url, token: token) DispatchQueue.main.async { [weak self] in self?.remoteParticipants = Array(room.remoteParticipants.values) } } catch { print("Failed to connect to room:", error) } } @objc func disconnect() async { await room?.disconnect() } }
t
I personally think
swift-export
progress hasn't gone to this far yet?
❤️ 1
m
well in my example i'm not using swift-export it's the other way around swift ->objc -> kotlin but still i don't think there is an easy way to do it if there is one.