How do I create a new Swift project without using Storyboards?

后端 未结 13 960
不知归路
不知归路 2020-11-29 15:47

Creating a new project in XCode 6 doesn\'t allow to disable Storyboards. You can only select Swift or Objective-C and to use or not Core Data.

I tried deleting the s

13条回答
  •  感情败类
    2020-11-29 16:19

    I recommend you use controller and xib

    MyViewController.swift and MyViewController.xib

    (You can create through File->New->File->Cocoa Touch Class and set "also create XIB file" true, sub class of UIViewController)

    class MyViewController: UIViewController {
       .....    
    }
    

    and In AppDelegate.swift func application write the following code

    ....
    var controller: MyViewController = MyViewController(nibName:"MyViewController",bundle:nil)
    self.window!.rootViewController = controller
    return true
    

    It should be work!

提交回复
热议问题