Kevin Sylvestre
Kevin Sylvestre

Reputation: 38012

Swift Subclassing Subclasses of UIViewController

I've created the sample Master-Detail Application in Xcode and I'm trying to setup a child view controller of the MasterViewController (say UltimateViewController) using:

class UltimateViewController: MasterViewController {}

This compiles, but if I open the storyboard I am unable to change (with autocomplete) the class name for the view controller to UltimateViewController. If I enter the name manually I am unable to wire up any existing @IBOutlets or @IBActions. Any pre-existing outlets show the warning indicator and the application crashes on launch. How can I do this type of inheritance?

Upvotes: 0

Views: 843

Answers (1)

Alex Reynolds
Alex Reynolds

Reputation: 6352

StoryBoard sometimes does not re-index project files when you create new ones so they are not available to choose when you want to change the subclass in storyboard. For me I usually Clean the project, Close Xcode, launch XCode, build and the class is now available.

You can also try deleting derived data for the project so it will for a total re-index of the project files. Lastly verify that the target of the file is correct.

Lastly make sure youre using xcode 6 :)

Upvotes: 1

Related Questions