mirror of
https://github.com/samsonjs/Advanced-NSOperations.git
synced 2026-03-25 08:25:47 +00:00
30 lines
999 B
Swift
30 lines
999 B
Swift
/*
|
||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||
See LICENSE.txt for this sample’s licensing information
|
||
|
||
Abstract:
|
||
A UISplitViewController subclass that is its own delegate.
|
||
*/
|
||
|
||
import UIKit
|
||
|
||
class SplitViewController: UISplitViewController {
|
||
// MARK: Life Cycle
|
||
|
||
override func awakeFromNib() {
|
||
super.awakeFromNib()
|
||
|
||
preferredDisplayMode = .AllVisible
|
||
|
||
delegate = self
|
||
}
|
||
}
|
||
|
||
extension SplitViewController: UISplitViewControllerDelegate {
|
||
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController, ontoPrimaryViewController primaryViewController: UIViewController) -> Bool {
|
||
guard let navigation = secondaryViewController as? UINavigationController else { return false }
|
||
guard let detail = navigation.viewControllers.first as? EarthquakeTableViewController else { return false }
|
||
|
||
return detail.earthquake == nil
|
||
}
|
||
}
|