I am implementing a application based on web services. In that I need to add a string as property in .plist and I need to get the value from the .plist whenever I need in the code.
Every iOS app uses an Info. plist file to store configuration data in a place where the system can easily access it to determine things like what icon to display, what languages or document types to support, and many other important behaviors.
All you have to do is click on the blue project icon -on top of the left- and go to the “Build Settings” tab, search “Info. plist” and choose “Info. plist File” section. Then change the information of the section from your folder's name.
fileManager. fileExists(atPath: path)){ if let bundlePath = Bundle. main. path(forResource: "myData", ofType: "plist"){ let result = NSMutableDictionary(contentsOfFile: bundlePath) print("Bundle file myData.
To create a plist file, it just as simple as creating a new class. Click menu File > New > File... ( ⌘ - CMD + N ).)
Here is a code sample:
NSString *path = [[NSBundle mainBundle] pathForResource: @"YourPLIST" ofType: @"plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile: path]; id obj = [dict objectForKey: @"YourKey"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With