Category Archive for ‘Recipes’

In the first part of this two-part blog post, you saw how NSAttributedString works with remote images when parsing HTML, namely synchronously downloading them. I teased that I found a way to have NSTextAttachment also work asynchronously. In this second part I will walk you through how this is achieved.

BSA Banner

In iOS 7, Apple introduced the NSTextAttachment class for embedding images into attributed strings. OS X, pardon macOS,did have this feature much earlier, already as early as 2001 in version 10.0 “Cheetah”. I suspect that they needed 7 years to migrate because the first needed to revamp the inner workings of UITextView and UITextField to natively work with attributed text, as well as modernize CoreText into what is nowadays referred to as TextKit.

With iOS 10 being released, we now have 3 major iOS releases supporting text attachment in standard UIKit views. About time, that we start using text attachments for displaying inline images in rich text.

Customizing a modal presentation of a view controller would be tricky before iOS 7. It got much easier with the addition of the transitioningDelegate protocol. This delegate would be able to vend an animation controller and an interaction controller for presentation and dismissal on the view controller which implemented them.

Without that, if you wanted a “burger menu” then you had to implement a custom container controller like I did with DTSidePanel in DTFoundation 1.4, three years ago. Things have gotten much easier a year ago.

A client of ours liked the way the Linked In app showed related apps in a modal side panel and so I went to research how you would that most reusably nowadays.

It’s been a while since I last submitted a build of prod.ly to the iTunes. So I figured, I should update Cocoapods to the latest version and do a pod update. The archiving went find, but then I saw a new iTunes error when I tried to upload the build.

In the latest version of iWoman we are finally coming around to implementing TouchID. Or more precisely: device owner authentication.

iOS 8 introduced the ability to let us use the user’s finger print for authentication. But if that wasn’t set up or otherwise unavailable, we still had to fall back to displaying a keypad via DTPinLock. iOS 9 finally gave us the ability to fall back on the device passcode, just like the user would use to unlock iPhone without TouchID.

For a project I needed a way to get a reference to a UISwitch contained in the contentView of a UITableViewCell. I remembered from my research for my Swift talk that there was this handy is operator, so I was excited to tweet that I had finally found the first good use for it.

I reported in an earlier post that there are some gotchas trying to localize an app with the combination of Xcode’s XLIFF export and POEditor.com. The latter stated that it is not their fault and somebody responsible for the former thanked me for my sample.

A future fix in Xcode notwithstanding, I found it necessary to create the Localizable and Main storyboard strings file from the XLIFF files exported from the translation site. This way I could be certain that the translations I care about all all accounted for.

Our app prod.ly recently got the ability to award achievements to users for a variety of activities. Now, achievements have little impact if you cannot translate those into a rush of dopamine for the winning user. To achieve that, we are planning to have a pop up show as soon as the achievement is awarded, congratulating the user.

From psychology we know that if something is colourful and has animation it has a larger emotional impact than something that is static and B/W. One ingredient that is often used to heighten the effect are what I call “Hero Rays”. In this tutorial I am showing how I achieved them.