I have a main app view controller where a image is set and fetched using user defaults as given below:
animalcat = ["s1.jpg","s2.jpg","s3.jpg","s4.jpg"]
var appGroupDefaults1 = UserDefaults.standard appGroupDefaults1 = UserDefaults(suiteName:"group.testKeyboard.Emo")!
appGroupDefaults1.set(animalcat, forKey: "imageValue")
appGroupDefaults1.synchronize()
This image has to fetched in keyboard extension class file, but the image is showing nil.
In keyboard extension-
let dataArray1 = appGroupDefaults1.object(forKey: "imageValue") print(dataArray1)
How to fetch the image from main app and show it in keyboard extension so that it is displayed when the keyboard is loaded?