Do Swift-Based Applications Work on Os X 10.9/Ios 7 and Lower

Do Swift-based applications work on OS X 10.9/iOS 7 and lower?

I just tested it for you, Swift applications compile into standard binaries and can be run on OS X 10.9 and iOS 7.


Simple Swift application used for testing:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

var controller = UIViewController()
var view = UIView(frame: CGRectMake(0, 0, 320, 568))
view.backgroundColor = UIColor.redColor()
controller.view = view

var label = UILabel(frame: CGRectMake(0, 0, 200, 21))
label.center = CGPointMake(160, 284)
label.textAlignment = NSTextAlignment.Center
label.text = "I'am a test label"
controller.view.addSubview(label)

self.window!.rootViewController = controller
self.window!.makeKeyAndVisible()
return true
}

Can we use Swift on iOS7 and below?

No,Swift is not supporting IOS6 and It's support from IOS 7.*.

Swift is supported on devices running iOS 7 or later.

Will code written in Swift work on iOS 7 and earlier?

They will work on iOS 7, but not earlier versions.

Will Swift 2.0 be compatible with OS X 10.9 or lower?

Swift's oldest supported deployment target is still OS X 10.9 and iOS 7. This is unchanged in Swift 2.

Certain APIs, however, are only available on later versions of these operating systems. I suspect this is what you mean by:

documentation that says Availability OS X 10.10 or later - in simple NS class docs

(As Martin R. notes in the comments, this is unrelated to the language, except that "Swift has better runtime check mechanisms.")

With Swift 2, you can check API availability using the #available syntax. Here's an example from the Xcode release notes:

if #available(iOS 8.0, OSX 10.10, *) {
// Use Handoff APIs when available.
let activity = NSUserActivity(activityType:"com.example.ShoppingList.view")
activity.becomeCurrent()
} else {
// Fall back when Handoff APIs not available.
}

Swift for ios7 or lower platforms

I believe that LLVM will compile for iOS 7 and up. They did confirm that it would not be compatible with iOS 6.

Can I write Apps in Swift 1 (For iOS 7 and 8) using Xcode 7?

There will be errors if you attempt to run swift 1 in xcode 7, and yes, swift 2 will run on IOS 7-9

RealityKit app and lower iOS deployment target

Firstly :

Do not include Reality Composer's .rcproject files in your archive for distribution. .rcproject bundles contain the code with iOS 13.0+ classes, structs and enums. Instead, supply your project with USDZ files.

Secondly :

To allow iOS 13+ users to use RealityKit features, but still allow non-AR users to run this app starting from iOS 10.0, use the following code (CONSIDER, IT'S A SIMULATOR VERSION):

import UIKit

#if canImport(RealityKit) && TARGET_OS_SIMULATOR

import RealityKit

@available(iOS 13.0, *)
class ViewController: UIViewController {

var arView = ARView(frame: .zero)

override func viewDidLoad() {
super.viewDidLoad()

arView.frame = self.view.frame
self.view.addSubview(arView)

let entity = ModelEntity(mesh: .generateBox(size: 0.1))
let anchor = AnchorEntity(world: [0,0,-2])
anchor.addChild(entity)
arView.scene.anchors.append(anchor)
}
}
#else

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
}
}

#endif

Deployment target is iOS 10.0:

Sample Image

Thirdly :

When publishing to the AppStore (in case we have a deployment target lower than iOS 13.0), we must make the import of this framework weakly linked in the build settings (that's because RealityKit is deeply integrated in iOS and Xcode).

So, go to Build Settings –> Linking -> Other linker Flags.

Double-click it, press +, and paste the following command:

-weak_framework RealityKit -weak_framework Combine

Sample Image

P.S. In Xcode 13.3, there's a project setting that also could help

OTHER_LDFLAGS = -weak_framework RealityFoundation

Fourthly :

So, go to Build Settings –> Framework Search Paths.

Then type there the following command:

$(SRCROOT)

it must be recursive.

Sample Image

Fifthly

The archives window:

Sample Image



Related Topics



Leave a reply



Submit