UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to add new features while still supporting old iOS versions

Recorded – watch the full episode on YouTube.

When you’re thinking about what it means to have a legacy code in your project what is that? What is legacy code in your definition?

Carola Nitz: I guess the simplest one is just code from someone else or that you inherited from an older version. Even something that I've written years ago that I don't know about any more really feels like it's code from someone else.

Paul Hudson: So Old Carola's code. You're like, "Who wrote this? Oh, it was me."

Carola Nitz: Yeah, seriously. It's like this feeling when you blame something, "Who wrote that damn line?" And you're like, "Oh darn it was me."

Paul Hudson: Exactly. So code from somebody else, or potentially from yourself that you've just forgotten about over time?

Carola Nitz: That's legacy code for me.

Paul Hudson: The biggest problems we have is that every year Apple bumps iOS, macOS, tvOS, and watchOS. And then they'll release a whole new set of phones and iPads or watches regularly. How do you support old systems such as iOS 10 while creating new parts for iOS 13 and later?

Carola Nitz: Going down to 10 – wow! That's really far back. I mean, if you can obviously try to reduce the numbers that you really need to support. Look at how many users are on the older versions because you need to think about your developers and your developers’ time. Decide the lowest version that you definitely need to support, and then try to have a physical device you work with that is using that lowest-supported iOS version. This means you actually see when there are problems because performance is often an issue with older devices. You can notice those earlier if you’re actually developing with the lowest-supported device. And then make sure if you have tests that you run them not only on iOS 13 but also iOS 12 and 11.

“Decide the lowest version you definitely need to support and then try to have a physical device that you work with that is using that lowest-supported iOS version.”

Paul Hudson: What iOS versions does Netflix support on iOS?

Carola Nitz: We only support the current one and the one before, so iOS 12.

Paul Hudson: iOS 12 was a good release because everyone on iOS 11 can get iOS 12 – that made our lives much easier because we could upgrade. But sadly iOS 13 was such a huge release – massive features left, right, and center. Combine, diffable data sources, compositional layouts, SwiftUI, SF symbols, and more – and only some devices support it. I think everyone's hoping iOS 14 will be another iOS 12 – a slower, stabler, simpler released that everyone on iOS 13 can get to!

Carola Nitz: But you're actually touching on a topic that's hard for developers. What do you do when you want to work with Combine but you still have older versions to support, or if not Combine then something else that is not available on a lower version.

"You don't want to have two code paths around so usually you wait until you can drop the old version so you can use a feature everywhere. That's at least my approach so far."

Paul Hudson: Yeah SwiftUI for example.

Carola Nitz: And you don't want to have to extra code paths, right? You don't want to have two code paths around so usually you wait until you can drop the old version, so you can use a feature everywhere. That's at least my approach so far – you don't want to have that old path there and some other one for newer software somewhere else.

Paul Hudson: There's certainly an interesting problem that hasn't been solve really yet, which is that developers like you who support iOS N and N minus one couldn't watch Dub Dub in 10 days time and go, “wow look at iOS 14, look at these things I can't actually use." What you really want is in a year and a half time to be told, “you can now use Combine." And that's hard because you're looking at next year’s WWDC stuff and what they're doing and it's always a bit of a treadmill.

Carola Nitz: I think people are actually going back to the WWDC of the version that is now the lowest one they support, thinking “oh what can I actually now use that I couldn't use before?"

This transcript was recorded as part of Swiftly Speaking. You can watch the full original episode on YouTube, or subscribe to the audio version on Apple Podcasts.

Listen on Apple Podcasts

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.