Create a new iOS12 project in Xcode11

Xcode iOS13 Storyboard

When you create a new project in Xcode 11, it will setup the project for deployment target of iOS 13. If you want to support iOS prior to iOS 13, there are a few steps you need to do.

Change deployment target #

Select your app target and go to General tab, under Deployment Info change target to whatever version you want to support.

Deployment target

@available all the things!! #

Since Xcode assume your project will be iOS 13, it created many things that are not compatible with iOS 12, e.g. SceneDelegate.swift.

So these are files you need to change to make it support old version of iOS.

  1. SceneDelegate.swift
    Add availability attributes to this whole class since this UIWindowSceneDelegate is for iOS 13 or greater.
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
  1. AppDelegate.swift
    In AppDelegate.swift there are two new UIApplicationDelegate methods that we need to Add @available(iOS 13.0, *)
// MARK: UISceneSession Lifecycle
@available(iOS 13.0, *)
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {

@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {

And the last step is to UIWindow variable back to AppDelegate

class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

Conclusion #

I don't remember Apple has an option to select deployment target in Xcode before, but since the introduction of iOS 13, as you can see, there is breaking changes. This breaking changes and not so straight forward modification might not be a problem for experienced developers, but I can see it might confuse beginners.

Hopefully, in the future, Apple will ask for the deployment target when creating a new project and prepare files needed for that target.

Reference #

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Tweet Share

If you enjoy this article, you can subscribe to the weekly newsletter.

Every Friday, you’ll get a quick recap of all articles and tips posted on this site — entirely for free.

← Home