{ struct Props: Codable { let refreshState: RefreshState; enum RefreshState: AutoCodable { case inactive(activate: Command) case active } let groups: [Group]; struct Group: Codable { let title: String var patients: [ReassignUserTableViewCell.Props] } static let initial = Props( refreshState: .inactive(activate: .nop), groups: [] ) } } class ReassignUserTableViewCell: UITableViewCell { /*implementation*/ } extension ReassignUserTableViewCell { struct Props: Codable { let effectiveDate: Date let phrase: String let icon: UIImage let temperature: WeatherFeature<Double> let realFeel: WeatherFeature<Double> let windSpeed: WeatherFeature<Double> let windDirection: String let select: CommandWith<UIViewController> } }
CommandWith<T> where T: Encodable { return CommandWith { message in guard let data = try? JSONEncoder().encode(message) else { return } self.client.publish(data, topic: channel, qos: 0, retain: true) } } } let mqtt = MQTT() let store = Store<State>(state: .initial) store.observe(with: mqtt.publish(in: "store/state")) STORE B
let publish: CommandWith<WeatherTableViewController.Props> = mqtt.publish(in: "props/WeatherTableViewController") let presenter = WeatherTableViewPresenter( store: store, render: render.then(publish.perform) ) P UI Props B