简体   繁体   中英

Xcode 6 - Template without Storyboards

I know this sounds trivial, but I'm quite irritated with the lack of an 'empty' template for iOS apps in beta 3/4.

I detest the Storyboard approach, (IMO it's naive to assume that it's always the most elegant approach).

In fact for the majority of my use cases, Storyboards simply don't work.

Can anyone advise me on how I can take the empty template and get to a starting point (app delegate with a window) without SB's? - or migrate one of the other templates to non SB.

that prepare for segue method gives me shivers it's so ugly...

Thanks in advance.

I don't like Storyboards either.

Here is what I do to go from a SB-template to nice and clean 'from code design':

  • create a project from the single-view template (gives you the least storyboard 'boilerplaite')
  • delete the Storyboard
  • go to your AppDelegate(.m / .swift) and create a UIWindow through code in application:didFinishLaunchingWithOptions: :

     CGRect screenBounds = [[UIScreen mainScreen] bounds]; UIWindow *window = [[UIWindow alloc] initWithFrame:screenBounds]; UIViewController *viewController = [[UIViewController alloc] init]; [window setRootViewController:viewController]; [window makeKeyAndVisible]; [self setWindow:window]; 
  • remember to go select your target and delete the 'MainInterface' entry in 'General' under 'Deployment Info'

From this point on, you are ready to go and Xcode won't annoy you with SB anymore :)

Unfortunately, I haven't found a way to save a project as a template so far :/

You probably don't want to just delete the file without telling the rest of the project..

You want to edit the plist and remove:

  • launch screen interface file base name
  • main storyboard file base name

That way, your app isn't looking for files that aren't there.

Then, add the code that Cabus says (which is just the code that Xcode used to provide in Xcode 5).

There's a github library for xcode 7 project template without storyborad, which followed Cabus answer.

https://github.com/elprup/xcode7-project-template

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM