Hello! I am using a Mac Swift Playground 3.4.1, and want to save data inputted on one playground page to be used across the other pages. I read in the Apple Documentation to use PlaygroundKeyValueStore, but when I put it into my playground page (after importing Playground Support), I get the error in above title. Is this function deprecated? Since it seems like it still worked in 2020.
Apple Documentation for this class:
https://developer.apple.com/documentation/playgroundsupport/playgroundkeyvaluestore
Apple Documentation for this class:
https://developer.apple.com/documentation/playgroundsupport/playgroundkeyvaluestore
Based on other descriptions in the doc, the code sample is a bit outdated.
It should be something like this:
You can send a bug report of this documentation bug using Apple's Feedback Assistant.
It should be something like this:
Code Block // Store a value. PlaygroundKeyValueStore.current["animal"] = .string("Llama") // Retreive that same value. var theAnimal: String? = nil if let keyValue = PlaygroundKeyValueStore.current["animal"], case .string(let animalType) = keyValue { theAnimal = animalType }
You can send a bug report of this documentation bug using Apple's Feedback Assistant.