Swift ベースのアプリケーションは OS X 10.9/iOS 7 以前で動作しますか? 質問する

Swift ベースのアプリケーションは OS X 10.9/iOS 7 以前で動作しますか? 質問する

SwiftベースのアプリケーションはOS X 10.9(Mavericks)/iOS 7以下ですか?

例えば、私はマシンを稼働させていますOS X 10.8(Mountain Lion) ですが、Swift で作成したアプリケーションが動作するかどうか疑問に思っています。

または、Mac OS を使用して Swift アプリケーションを作成するには何が必要ですか?

ベストアンサー1

テストしてみました。Swift アプリケーションは標準バイナリにコンパイルされ、OS X 10.9 および iOS 7 で実行できます。


テストに使用されるシンプルな Swift アプリケーション:

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
}

おすすめ記事