forked from shadowfacts/Tusker
Fix crash when accessing SegmentedPageViewController before it's loaded
This commit is contained in:
parent
79b9108a8f
commit
358d81b5cf
|
@ -85,7 +85,7 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
}
|
}
|
||||||
|
|
||||||
func stateRestorationActivity() -> NSUserActivity? {
|
func stateRestorationActivity() -> NSUserActivity? {
|
||||||
return (currentViewController as! TimelineViewController).stateRestorationActivity()
|
return (currentViewController as? TimelineViewController)?.stateRestorationActivity()
|
||||||
}
|
}
|
||||||
|
|
||||||
func restoreActivity(_ activity: NSUserActivity) {
|
func restoreActivity(_ activity: NSUserActivity) {
|
||||||
|
|
|
@ -23,8 +23,8 @@ class SegmentedPageViewController<Page: SegmentedPageViewControllerPage>: UIPage
|
||||||
var currentIndex: Int! {
|
var currentIndex: Int! {
|
||||||
pages.firstIndex(of: currentPage)
|
pages.firstIndex(of: currentPage)
|
||||||
}
|
}
|
||||||
var currentViewController: UIViewController {
|
var currentViewController: UIViewController! {
|
||||||
viewControllers!.first!
|
viewControllers?.first
|
||||||
}
|
}
|
||||||
|
|
||||||
let segmentedControl = ScrollingSegmentedControl<Page>()
|
let segmentedControl = ScrollingSegmentedControl<Page>()
|
||||||
|
|
Loading…
Reference in New Issue