Created
November 22, 2021 15:55
-
-
Save vikingosegundo/3a14a0478ebb454376181850709820d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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