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 …
Monthly Archives: August 2015
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()) …
Continue reading “Evaluate string width and return CGFloat (Swift, OSX)”
CSV Parser Swift 2
One of the features I’m adding to an upcoming app is the ability to import CSV files. For that purpose I looked around for code already available (and found several options, see below), however none of them compelled me enough so I decided to create my own. The main objective was to make it as …