I searched a way (or a template) how to read variables which are stored in plist files. I saw a few codes, but no code worked with the newest Swift version.
I'm new to Swift, I actually don't check exactly how it works.. Could anyone be so nice and give me an example?
I have a CollectionView and want to display the strings in my plist file. That's my plist file:
For every animal key (dictionary type) two sub keys (name and picture). Root --> Animals --> Animals1
All Keys expept "name" and "picture" are dictionaries. Now I want to get the dictionaries and show the name and the picture in my collection view. Later I will add more vars. I hope it's understandable :'D
The incomplete code I have:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let path = Bundle.main.path(forResource: "Animals", ofType:"plist")!
let dict = NSDictionary(contentsOfFile: path)
SortData = dict!.object(forKey: "Animals") as! [Dictionary]
}