Objective-C Tips & Trick - Prioregroup.com
[Objective-C] Settings from a PLIST file
       
back

static NSDictionary *settings;

+ (id)settingsValueForKeyPath:(NSString*)keyPath
{
    if (settings == nil) {
        NSString *plistPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"settings.plist"];
        settings = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
    }
    
    return [settings valueForKeyPath:keyPath];
}






Copyright © 1996-2018 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com