Skip to content

Instantly share code, notes, and snippets.

@vikingosegundo
Created November 22, 2021 15:55
Show Gist options
  • Save vikingosegundo/3a14a0478ebb454376181850709820d6 to your computer and use it in GitHub Desktop.
Save vikingosegundo/3a14a0478ebb454376181850709820d6 to your computer and use it in GitHub Desktop.
import Foundation
import BrighterModel
typealias Input = (Message) -> ()
typealias Output = (Message) -> ()
func createAppCore(
store : Store,
receivers : [Input],
rootHandler: @escaping Output) -> Input
{
store.updated {
#if targetEnvironment(simulator)
print("\(state(in: store))")
#endif
}
let stack = LightsStack(client: HueClient(ip :"192.168.178.37",
user:"0cpSVXBH47AspTz8yz6xzPRH4e4DHIktuE18IUhd"))
let features: [Input] = [
createLightingFeature (store:store, lightsStack:stack, output:rootHandler),
createDashboardFeature(store:store, output:rootHandler),
createLoggingFeature()
]
return { msg in
(receivers + features).forEach { $0(msg) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment