Self-sizing Child Views

If you are struggling with massive view controllers you are likely to come across the suggestion to use container view controllers. A parent view controller splits a user interface into several, simpler, child view controllers. You add the root views of each child view controller to the parent which sets the size and position of the child views (manually or with Auto Layout).

What I find less well documented is how to implement a self-sizing child view. In this post, I look at how the UIContentContainer protocol allows the child view controller to tell the parent how big it wants to be (and an alternate, possibly simpler, approach).

Read On →

Creating Strings From Raw Text In Swift 5

Creating Swift strings from raw text can often be a pain. Properly escaping any quotes or backslash characters in the raw text is an exercise in frustration. Swift 5, shipping with Xcode 10.2, introduces a new syntax to make it easier to work with raw text.

Read On →

Character Properties in Swift 5

The release of Swift 5 is coming with Xcode 10.2 and brings some updates to the String API in the standard library. Here’s a look at the new character properties that allow you to test for a number of useful Unicode properties.

Read On →

Faster App Setup For Unit Tests

When Xcode runs your unit tests, it uses the App as a host for the tests. The tests only run after the App has finished launching. Loading core data, networking or other setup work you do from the App delegate slows down your unit tests. Here’s a quick tip to create a custom scheme to avoid unnecessary work when unit testing.

Read On →

Refactoring With Protocols

The classic text on refactoring by Martin Fowler just got updated to a 2nd edition. How relevant is it to iOS developers? The book uses Javascript for the code examples but the techniques are language independent so don’t let that put you off. What Swift developers might miss is the use of protocols.

Read On →
Archives Categories

No time to watch WWDC videos?

Sign up to get my iOS posts and news direct to your inbox and also get my free iOS Size Classes Cheat Sheet

Unsubscribe at any time. See Privacy Policy.