Replacing flatMap With compactMap

Swift 4.1 ships with the (still in beta) Xcode 9.3 and brings more changes to the Swift language and the Swift standard library. Apple intends it as a source compatible upgrade to Swift 4.0 but I have hit one source code change that I am guessing will be widespread.

Using flatMap on a sequence (like an Array) filtering anything that maps to nil is now deprecated and replaced by compactMap.

Read On →

Creating Custom Xcode Project Templates

I recently wanted to play with some projects that did not use a main Storyboard. Starting from the single view app template it soon gets tiring to clean things up and add the boilerplate to the app delegate to create the window. This seems like a good time to learn how to create my own custom Xcode project template. Here are my notes for future reference.

Read On →

Masked And Animated Corners

Apple loves a rounded rectangle. They even sneaked a couple of improvements into iOS 11. I saw these two tips during WWDC 2017 and then forgot about them.

Read On →

Swift Non-Nil Values In An Array Of Optionals

I find it hard to remember the different ways you can use case with Swift beyond the familiar switch. Here is one useful example for when you need to do something with the non-nil values in an array of optionals.

Read On →

Changing Xcode Header Comment

Have you ever wanted to change the standard header comment that Xcode automatically puts at the top of ever new source file you add to a project? Maybe you just don’t like the default or need to include your own copyright or license text. Xcode 9 added a FILEHEADER text macro to allow you to do just that.

Read On →
Archives Categories
No time to watch WWDC videos?

Sign up to get my iOS posts direct to your inbox and I will send you a free PDF of my iOS Size Classes Cheat Sheet.

OK! Check your inbox (or spam folder) for an email to confirm your details and download your free guide to iOS Size Classes.

There was an error submitting your subscription. Please try again.

Unsubscribe at any time.