Snippets

Fabian Hernando Leon Ortega Swift - Common Tasks

You are viewing an old version of this snippet. View the current version.
Revised by Fabian Leon da46ae3
// Change language application dinamically

var language = "de"
let path = NSBundle.mainBundle().pathForResource(language, ofType: "lproj")
let bundle = NSBundle(path: path!)
let string = bundle?.localizedStringForKey("key", value: nil, table: nil)

// print device token of push notification

 let characterSet: NSCharacterSet = NSCharacterSet( charactersInString: "<>" )
 
 let deviceTokenString: String = ( deviceToken.description as NSString )
            .stringByTrimmingCharactersInSet( characterSet )
            .stringByReplacingOccurrencesOfString( " ", withString: "" ) as String
        
 print("Device token: \(deviceTokenString)" )
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.