且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

基于 Swift 的应用程序是否可以在 OS X 10.9/iOS 7 及更低版本上运行?

更新时间:2023-12-04 13:49:00

我刚刚为您测试了它,Swift 应用程序编译为标准二进制文件,可以在 OS X 10.9 和 iOS 7 上运行.

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

用于测试的简单 Swift 应用程序:

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
}