Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. struct Keys {
  2. static let val1 = "val1"
  3. static let val2 = "val2"
  4. static let text = "text"
  5. }
  6.  
  7. func saveSettings() {
  8. let cloudStore = NSUbiquitousKeyValueStore.default
  9.  
  10. cloudStore.setValue(segmented1.selectedSegmentIndex, forKey: Keys.val1)
  11. cloudStore.setValue(segmented2.selectedSegmentIndex, forKey: Keys.val2)
  12. cloudStore.setValue(textField.text, forKey: Keys.text)
  13.  
  14. if cloudStore.synchronize() {
  15. print("Syncronized!")
  16. } else {
  17. print("Failed to syncronize...")
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement