Tips & Tricks
Everything you ever wanted to know but never dared to search for...

Load Content of a resource file in a string

if let f = NSBundle.mainBundle().pathForResource ("myPage", ofType: "html") {
    if let content = String(contentsOfFile:f, encoding: NSUTF8StringEncoding, error: nil) {

Generate a unique ID

let id = NSUUID().UUIDString

Simple use of NSUserDefaults

let defaults = NSUserDefaults.standardUserDefaults()
defaults.setBool(true, forKey: “favoritesEnabled")
let favoritesEnabled = defaults.boolForKey("favoritesEnabled")

Gaetano Causio © | Privacy Policy | Disclaimer