Sha256: e9167145cc17d8b5fbd8a6f210303b52bfc167a235ca818742c01f028e47e181
Contents?: true
Size: 1.07 KB
Versions: 18
Compression:
Stored size: 1.07 KB
Contents
import Foundation import Strada import UIKit final class FlashMessageComponent: BridgeComponent { override class var name: String { "flash-message" } override func onReceive(message: Message) { guard let event = Event(rawValue: message.event) else { return } if event == .connect { handleConnectEvent(message: message) } } @objc func performAction() { reply(to: Event.connect.rawValue) } // MARK: Private private var viewController: UIViewController? { delegate.destination as? UIViewController } private func handleConnectEvent(message: Message) { guard let data: MessageData = message.data() else { return } guard let viewController else { return } viewController.parent?.presentToast(data.title) } } // MARK: Events private extension FlashMessageComponent { enum Event: String { case connect } } // MARK: Message data private extension FlashMessageComponent { struct MessageData: Decodable { let title: String } }
Version data entries
18 entries across 9 versions & 1 rubygems