Aim: to make a generic ViewController and TableViewController which would be able to return themselves from the existing storyboards and which would be subclassed by other view controllers and allow them to use this functionality.
class GenericTableViewController: UITableViewController
{
//MARK: Storyboard
class func storyboardName() -> String
{
return ""
}
class func storyboardIdentifier() -> String
{
return ""
}
class func existingStoryboardControllerTemplate() -> Self
{
return UIStoryboard.storyboardWithName(storyboardName()).instantiateViewControllerWithIdentifier(storyboardIdentifier()) as! Self
}
}
The problem is.. the compiler forces me to change the Self to this "GenericTableViewController" and if I change it... it complains that I no longer return "Self".
Is there something that can fix this?