May 30, 2016

Delegate calls wrapped in computed properties

In the app I’m currently working I have a view that asks its delegate for the locale to use when rendering it’s model object. The model has strings for all of the supported locales embeded in it and its just a matter of using the correct one when rendering. The view itself can go through a number of different transitions which is why I need to ask the delegate a few times in a few different places for what locale to use.

Read more...
May 20, 2016

Getting rid of typographic orphans with Swift

I composed this little Swift string extension to get rid of typographic orphans when rendering titles and such: // // String+Typography.swift // FilibabaKit // // Created by Simon Ljungberg on 09/05/16. // Copyright © 2016 Filibaba. All rights reserved. // import Foundation extension String { /** String Without Orphan - Returns: The string with the last space replaced with a non-breaking space to avoid orphans. */ var stringWithoutOrphan: String? { get { let space = NSCharacterSet(charactersInString: " ") if let lastSpace = self.

Read more...
May 19, 2016

UIStackView: Left align without stretching

UIStackView introduced in iOS 9 is awesome. However, as someone coming from the HTML/CSS programming world I sometimes find that it does not really match up with the mental model I have of how it should work. There’s not any straight forward way of putting a number of absolutely sized items in a stack view and aligning them to either side. You can make them stretch to fill, distribute equally over the entire width of the stack view and you can center them.

Read more...
October 9, 2015

Live Debugging Node.js in Vim: update

Just wanted to post a super quick update! Since posting my article a few months back there’s been some activity in the repository for the node-vim-debugger! Looks amazing! (If I was the kind of person to take credit for stuff I’d like to imagine that I sparked the burst of development creating an issue. Luckliy I’m very humble and would never do such a thing. ;))

September 14, 2015

My Résumé: or How I Accidentally Built a Static Site Generator

One thing that I did not really realize when I started freelancing was that potentially customers sometimes asks for a résumé. I hadn’t had a résumé in over six years. And I probably only wrote one or two before that. So last week when I was approached by a company, that I really wanted to work with, asked for my résumé I sat down to write one. I opened up a new Google Docs file and started writing.

Read more...
August 16, 2015

Reactive Cocoa

Here’s a nice article that explains Reactive Cocoa in a very succint way. I don’t think I’ll ever really get into this style of programming (mostly because I don’t feel super comfortable basing an app entirely on third party frameworks). But I find it really fascinating and cool!

August 16, 2015

Node's Require and Browserify: Take 2

A while back I wrote about taking advantage of Node’s require algorithm with Browserify. While I liked the concept of doing that I never really liked how it made things look file-wise. Well. Turns out you don’t need to wrap your little module in a directory or give it a package.json! Say you have a module called… let’s say do-some-math that exports some fancy math functions that are unique do your project.

Read more...
August 14, 2015

My Watch and I

This started out as a 700+ word review of the Apple Watch. Then I read it and realized that I was just repeating what everyone else have already said about it. So, I threw it away. What remains is a short list of observations, still mostly echoing others. The try-on experience in the store was weird, but kind of fun. I went with the classic leather buckle. Comfort wise it’s comparable to the black sportband (which I also got).

Read more...
July 31, 2015

UIStackView and Autolayout

Was about to tear my own hair off due to issue with UIStackView and autolayout. Here’s a simplified version of my view hierarchy: - UIStackView - MyCustomView - UILabel - MyCustomView - UILabel - MyCustomView - UILabel The stack view are laying the custom views out in a horizontal fashion. Now, whenever I added a constraint similar to this: let xConstraint = NSLayoutConstraint(item: label, attribute: .Left, relatedBy: .Equal, toItem: self, attribute: .

Read more...
May 8, 2015

iOS Storyboard Tips & Tricks

I’ve been spending some time diving into iOS development for reals during my spare time the last couple of months. In this time I’ve come to learn a lot of things about storyboards, other than that they are pretty awesome. Here are two things in particular. Table View Data Sources and Delegates In the very first issue of objc.io they discuss how to make your UITableViewControllers lighter by moving data sources and delegates to separate objects.

Read more...