Basically I'm trying to do this in Swift
// get the Detail view controller in our UISplitViewController (nil if not in one)
id detail = self.splitViewController.viewControllers[1];
// if Detail is a UINavigationController, look at its root view controller to find it
if ([detail isKindOfClass:[UINavigationController class]]) {
detail = [((UINavigationController *)detail).viewControllers firstObject];
}
I've got as far as this;
var detail : AnyObject = self.splitViewController.viewControllers[1]
if detail.isKindOfClass(UINavigationController) {
detail = ((detail: UINavigationController).detail).
but I can't find what to do after this.
Another separate quick question. Is it considered good practice to have a lot of statements ending in as [type]
. It's mainly resulting from the use of AnyObject's, like using valueForKeyPath for instance. It just seems a bit messy having it all over my code