Screen Shot 2016-02-19 at 17.00.27

Convenient NSTextAttachment image resizing

Today i was faced with the task of building a dynamic NSAttributedString consiting of arbitrary text and icons. Obviously all the icons had to match the text size. Starting point This can be accomplished by just setting the bounds of the NSTextAttachment like so: textAttachment.bounds = CGRectMake(0, 0, 16, 16) Sure, that works but it’s not a very…


GCD

Keeping it to the main thread

You probably know that UIKit is not thread safe, so for instance if you want to display an alert following a network request you need to make sure that it runs on the main thread. Most developers will resort to dispatch_async to help them with that. – (void)showErrorMessage { dispatch_async(dispatch_get_main_queue(), ^{ [[[UIAlertView alloc] initWithTitle:nil message:@"Something's wrong"…


automate

Automated Xcode 6 Bot TestFlight Uploads

Once upon a time, there was a script for uploading Xcode Bot builds to TestFlight automagically. You can find it here but sadly it doesnt work with Xcode 6, like everything else. I’ve created a new script that will do the same job. It’s been tested with Xcode 6.1.1, Xcode Server 4.0 and Yosemite 10.10.1.…