Question posted in Xcode
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
2
Answers
Add this in a
.swift
fileThen Change the
Info.plist
Make sure your remove the file that has the
@main
from the target. TheContentView
gets created by the scene.I have achieved creating an iOS 13 compatible SwiftUI project with the following approach. This has one block for iOS 13 and another block for iOS 14+
Step 0: Create a SwiftUI project with XCode
This will have a main swift file and a
ContentView.swift
.Step 1: Update
Info.plist
as follows.Step 2: Update main swift file with the following code.
Step 3: Test
XCode -> Preferences -> Components
if #available(iOS 14, *) {}
conditions on code block and@available(iOS 15, *)
on classes or other objects.