Last active
October 16, 2018 03:32
-
-
Save lachlanagnew/690727ff37a36ba49653a42145bcc27c 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
| @IBAction func onChangeSelection(_ sender: Any) { | |
| let COLORS = ["ff0000","00ff00","0000ff"] | |
| let selection = selectionSegment.selectedSegmentIndex | |
| let color = COLORS[selection] | |
| let ref = Firestore.firestore().collection("settings").document("device1") | |
| ref.setData([ | |
| "status": selection, | |
| "color": color | |
| ]){ err in | |
| if let err = err { | |
| print("Error writing document: \(err)") | |
| } else { | |
| print("Document successfully written!") | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment