Working with NSUserDefaults in Swift 2

I was quite pleased to see than in Swift is even easier than in Objective-C. Here is how you do it: Create a variable that can access them:        var userDefaults = NSUserDefaults.standardUserDefaults()   Add values to dictionary:       userDefaults.setObject(“StringText”, forKey: “KeyInDictionary”)   Read values from dictionary:            let text = userDefaults.objectForKey(“KeyInDictionary”) as! …

Switching NSViewControllers from NSWindowController

This has taken quite some time to crack as there was not that much available information online.  I wanted a very simple way to change the NSViewController of a window on the fly by using code.  The solution I ended up with is quite easy, on the NSWindowController I load the default NSViewController by typing …

Get NSDate Day, Month or Year in Swift 2.0

Looking for Swift 3.0 version? -> Click here  Well, having recharged batteries after vacation I’m back into coding! And yet again I was faced with another simple problem: how to get the day, month or year from a date.  This is the simpler solution I’ve found in Swift 2:   //Here I’m creating the calendar …

Dates & Components in Swift 2.0

Another topic that has been changed in Swift 2.0 is how to work with dates. I’m digging into this topic for my upcoming app and I’ve found that most documentation on the web refers to Swift 1.2. So here are some snippets to create dates using components: //CreateDateFromComponents (1st January 2016)        var …

Evaluate string width and return CGFloat (Swift, OSX)

This morning I’ve been working in a Swift function to detect the width of a given text and return a CGFloat.  I’ve not found that many examples on the web for OSX, so here you have what I’ve done in all of its glory: func evaluateStringWidth (textToEvaluate: String) -> CGFloat{     letfont = NSFont.userFontOfSize(NSFont.systemFontSize()) …

Compatibility updates

Today both Excelling and Notio have been received a compatibility update to ensure they work great under iOS9. Provided that Apple approves them both should be available for users in about a week.  And now back to focusing on the new app.    Marc