Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Application Scene in blank OS X Storyboard

I try to transfer an existing cocoa application to make use of the new storyboards for OS X with XCode6 (Beta2). I added a new blank storyboard file and set it as the main interface of my application.

However, I have no idea how to link my NSApplication to this storyboard.

When I start a new project using storyboards I see a scene called application scene. It includes the Application (NSApplication object), Main Menu, AppDelegate...

How can I add an application object (i.e. an application scene) to a blank storyboard?

Is there something analogous to window controller and view controller objects which can be dragged on the storyboard?

like image 892
mic Avatar asked Jun 25 '14 21:06

mic


People also ask

How do I add a scene in storyboard?

In the Storyboard toolbar, click the New Scene button. Right-click on a panel and select New Scene. In the top menu, select Storyboard > New > New Scene.

How do I create a scene in Xcode?

Create a New Scene File First, add a new scene file to your project through Xcode's File menu > New... > File > (choose your platform tab) > SpriteKit Scene.

Why is Main Storyboard not showing up in Xcode?

You have SwiftUI enabled in your project, which does not use storyboards anymore. Your layout is inside the ContentView. swift file. If you do want to work the old way, with storyboards, you should uncheck 'Use SwiftUI' in the project creation screen.

How do I remove the main storyboard from my project?

Your new project has been created, now navigate to the left side of your interface, select the “Main. storyboard” file in the main folder, left-click and hit delete.


2 Answers

As a quicker alternative, you could copy the Application Scene from a new project to your existing one:

  1. Create a new, empty project with the "Use storyboards" option enabled.
  2. In the new project, option-click the storyboard file, select "Open with External Editor".
  3. In your favorite text editor, select the Scene node right under "<!--Application-->" and copy it to clipboard.
  4. In the project that has a missing Application Scene, repeat step 2.
  5. Paste the scene node you just copied at the top of the Scenes node (mind the plural!).
  6. Save.

You'll now have an Application Scene in your existing project, which saves a lot of time compared to copying everything over to a new project.

like image 165
Rachid Finge Jr Avatar answered Sep 28 '22 10:09

Rachid Finge Jr


Some people at the Apple Developer Forum seem to have the same problem as well: Mac Storyboard and Application Menus

It seems that currently there is no out-of-the-box way of migrating an existing application to use storyboards. That's true at least for XCode6 Beta2.

I ended up creating a new project and transferring my existing code base manually.

like image 45
mic Avatar answered Sep 28 '22 09:09

mic