I had a quick question related to initially loading the secondary view in UISplitView. I've currently got the code in my masterVC.swift to populate the detailsVC with the first object in an array if there is one. This works fine, the problem is that when the array is empty I predictably get fatal error: unexpectedly found nil while unwrapping an Optional value
.
So my question is, when there are no objects, how can I set a separate "no objects founds" style screen to fall back on?
Thanks, here's the code from my MasterVC viewDidLoad
let initialIndexPath = NSIndexPath(forRow: 0, inSection: 0)
if objects.count != 0 {
self.tableView.selectRowAtIndexPath(initialIndexPath, animated: true, scrollPosition:UITableViewScrollPosition.None)
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
self.performSegueWithIdentifier("showDetailsSegue", sender: initialIndexPath)
}
} else {
// I'm guessing the code would go here.
}