Created
January 15, 2020 14:27
-
-
Save AlexanderKozhevin/eef343b7e3e221b42bc789e3ea7db688 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
func StorageSave(key: String, value: String){ | |
let appDelegate = UIApplication.shared.delegate as! AppDelegate | |
let context = appDelegate.persistentContainer.viewContext | |
let store = context.persistentStoreCoordinator?.persistentStores.first | |
let coordinator = context.persistentStoreCoordinator | |
if let store = context.persistentStoreCoordinator?.persistentStores.first { | |
let metadata = fillMetadata(store: store, key: key, value: value) | |
store.metadata = metadata | |
do { | |
try coordinator?.setMetadata(["push_url": value], for: store) | |
try context.save() | |
} catch { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment