local-host 2014-06-02 19:25 采纳率: 100%
浏览 587
已采纳

基于 swift 的应用程序能在 OS x 10.9 / ios7和更低的版本上运行吗?

Will Swift-based applications work on OS X 10.9 (Mavericks)/iOS 7 and lower?

For example, I have a machine running OS X 10.8 (Mountain Lion), and I am wondering if an application I write in Swift will run on it.

转载于:https://stackoverflow.com/questions/24001778/do-swift-based-applications-work-on-os-x-10-9-ios-7-and-lower

  • 写回答

18条回答 默认 最新

  • MAO-EYE 2014-06-02 20:11
    关注

    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
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(17条)

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型