Member-only story

plist iOS

Mr.Javed Multani
2 min readOct 2, 2020

--

Plist is used for storage of data in iOS app. Plist save data in form of Array and Dictionaries. In plist we can save data as: 1. Static data to be used in app. 2. Data that will be coming from server.

Example:

1. Static data to be used in app.

To save static data in plist follow these methods:

a) Add a new file

b) Click Property list in Resources

c) Name the propertylist and a file will be created as(data.plist here)

d) You can create a plist of Arrays and Dictionaries as:

// Read plist from bundle and get Root Dictionary out of it

NSDictionary *dictRoot = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@”Data” ofType:@”plist”]];

// Your dictionary contains an array of dictionary // Now pull an Array out of it.

NSArray *arrayList = [NSArray arrayWithArray:[dictRoot objectForKey:@"Object1"]];for(int i=0; i< [arrayList count]; i++)
{
NSMutableDictionary *details=[arrayList objectAtIndex:i];
}

--

--

Mr.Javed Multani
Mr.Javed Multani

Written by Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer

No responses yet