I have the following code:
class MySuperClass : UIViewController {
var model: ModelA!
}
class ModelA {
var aBool = true
}
class ModelB: ModelA {
var boolBelongsToB = true
}
class MySubclass: MySuperclass {
func testFunction() {
let theBool = (model as! ModelB).boolBelongsToB // Simplify this
}
}
var aSubclass = MySubclass()
var aModelB = ModelB()
aSubclass.model = aModelB
What I want to do is simplify having to use the code (model as! ModelB)
everytime I want to access my model in MySubclass. How can I do this?