10

I just installed Xcode on my new MacBook. The new starting templates for Swift iOS require iOS SDK 13+ (ie they either need UISceneDelegate or SwiftUI). Is there a way to create a new app using a built-in template that is compatible with iOS 12?

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
Frederic
  • 499
  • 2
  • 7
  • 14
  • Just update the deployment target to iOS 12 or earlier and you can support that version of iOS as well as the latest version. – rmaddy Sep 22 '19 at 03:44
  • I guess I can just delete SceneDelegate.swift if I'm not using SwiftUI? – Frederic Sep 23 '19 at 18:04
  • SceneDelegate.swift has nothing to do with SwiftUI. – rmaddy Sep 23 '19 at 18:04
  • I guess I am not being clear. The template has three files. AppDelegate, SceneDelegate, and ViewController. The first 2 have numerous references that conflict with iOS 12. Do you recommend that I @available these to silence them? – Frederic Sep 23 '19 at 18:10
  • 2
    Yes. You should support iOS 13 in your app. But that doesn't prevent you from also supporting iOS 12 or 11 as well. The answer you accepted below is only half of what you need. – rmaddy Sep 23 '19 at 18:12

3 Answers3

14

The steps to getting to an iOS 12/13 app:

1) Change deployment target to iOS 12.

2) Replace the AppDelegate's methods with what they ought to have for iOS 12 development. Also add this:

   var window: UIWindow?

3) Remove SceneDelegate.

4) Remove Application Scene Manifest in your info.plist.

Originally answered here

Rammohan Raja
  • 616
  • 1
  • 6
  • 10
5

First of all, Make sure to not selecting SwiftUI as user interface in template picker (select storyboard instead). Because SwiftUI requires iOS 13 (You can have SwiftUI only for iOS 13 and above beside UIKit for below iOS 13 at the same time, but it has some more extra work to do):

Storyboard

Second of all, make sure to choose lower target dependency (like 12.4) in general tap of the project settings:

Target

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
2

Another option is to use some simple template or example project.

https://github.com/PacktPublishing/The-10-Day-iPhone-App-Bootcamp---New-iOS-12-and-Xcode/tree/master/S01

You need to download that zip ,and open project file "Swift Fun.xcodeproj" with xCode 11

I use this to start and learn, this may help you.

BuffK
  • 1,189
  • 14
  • 17