How to change Xcode generated files to Swift from Objective-C - xcode

I am new to Xcode and am not sure what I am doing. However a projected I am working on started with Objective-C, and upon realizing aspects of the language, I'd like to change to Swift. Whenever I make a view controller on storyboard, it makes it in Objective-C. How can I change the settings so it makes the auto-generated files in Swift instead?
Should be easy, right? I do not want to restart the project.
Thanks.

Whenever I make a view controller on storyboard, it makes it in Objective-C
A view controller on the storyboard has no language, and making a view controller in the storyboard does not auto-generate any files, so the question as it stands makes no sense.
What does have a language are the view controller subclass files you create for the project. The language of those is up to you at the moment of creation. Note the language pop-up in the File > New > File dialog:

Related

Add a second UIViewController within a single-view application

I have a single-view application open. I need to have two storyboard views (UIViewControllers), because one is a Table View, but when one of the Table View elements is selected it brings up another screen with a normal UIViewController. Is there any way of creating a second storyboard view (UIViewController)?
Of course! Those templates Xcode provides are in no way "set-in-stone". When Xcode created your Single-View Template, it just gave you a base for creating something more. You can create additional classes, view controllers, views, and resources (other than what Xcode starts you off with in a few ways).
To add another View Controller to your Storyboard, just drag and drop one from the Object Library:
It seems like you do not have a basic understanding of using or developing with Xcode. I would recommend reading over all of Apple's documentation on Xcode before going any further. The Building A User Interface section may be of particular interest to you.

How can I change the default code generated when creating a new file in Xcode5?

I must be wording this funny because I can't even get close to a fruitful search.
When I create a new file through the graphical interface (right-click -> new file -> Objective-c class) I want my personal pragma marks to be stubbed out.
How can I specify a template for this in Xcode5?
I apologize if this is obvious or well documented already.
EDIT 11/18
To be more specific, I am not talking about project templates (Master-Detail, Tabbed Application, etc) but rather file templates. An example would be how new (Xcode generated) UIViewController subclasses come with some of the view lifecycle delegate methods like viewDidLoad and such. I would like control over that boilerplate/stubs are created on a per-file/subclasss basis.

Steps to convert a new xcode cocoa project using 1 controller per nib

I want to start off my new xcode project using 1 nib per controller. By default it seems xcode creates:
1. delegate .h/.m
2. MainMenu.xib
And looking at the targets for the project, I see that the 'main nib file base name' is set to MainMenu, the principal class is NSApplication.
Since cocoa is MVC based, how are things MVC based on the default template?
How can I wire things together with a 'MainWindowController' instead of this default setup? If someone can explain the steps to me that would be much appreciated.
You don't want to subvert or change the default setup, just to understand it and work within it. MVC is a description of responsibility rather than some hard requirement about naming.
The delegate .h/.m is the app delegate by name, but its responsibility is to be the app controller. It gets everything setup when the app starts and deals with application level events. It shouldn't do anything that isn't related to application level management.
The MainMenu.xib is just a container / archive of the first Views and Controllers that are to be created when the application opens.
There is no Model in the template really as all it does is display the main window with a static string on it...
Your goal of using 1 nib per controller is fine, but you should be a little flexible with the naming at first. Because the MainMenu.xib contains the main window it should also contain your MainWindowController. This is perfect from an MVC point of view because you are separating the responsibility.
Then, your future Controllers and Views (in their XIBs) can have matching names to keep everything clear. And you can created your Model separately.

Xcode 4.3: how to create a nib linked to a view controller

Sorry, I'm quite new with xcode with a quite big project.
I upgrade xcode to 4.3.
I have a project (that doesn't use storyboard) and I need to add a view controller with a nib file.
Before upgrading I did File --> Ne File --> Cocoa Objective-C subclass and xcode created for me the m/h and their nib file.
Now that that option is disappear, how can I add a view controller?
I created the Objective-C class and, separately, a nib file, but how can I link the H/m files to the nib??
How can the m file call is nib??
Please can you help me? The project is real big and I can rewrite the code with the storyboard option!
Thanks
When editing your XIB, go to the Identity Inspector (it's the third button show in the following image). Then where it says Class, choose the controller you want to associate with the XIB.

How can i make a .XIB from .h and .m files?

I'm working on an existing project which I basically need to create a .XIB
so I can then put in UIToolbar and UIButtons ect.
On the App already it has a Tab bar but has been inputted through code and not the Interface Builder.
I would appreciate any guidance on my problem.
Kind Regards.
There is no automatic code that does this for you. You'll need to look in the code, find all UIView instances that need to go into the nib and manually create it. Then you'll have to be sure to set the frame of each of them to the same positioning as what is defined in the code. Finally, you'll have to be sure to remove all of that from the code (once it is fully migrated to the nib). Finally, you'll have to be sure that the components are referenced only after the nib has fully loaded (which might not have been the case in the current code).
Why not keep the components in the code (and just use nibs for new views)?

Resources