-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathSceneDelegate.swift
More file actions
39 lines (33 loc) · 1.42 KB
/
Copy pathSceneDelegate.swift
File metadata and controls
39 lines (33 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// SceneDelegate.swift
// Example
//
// Created by Denys Telezhkin on 14.08.2020.
// Copyright © 2020 Denys Telezhkin. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
// MARK: - UIWindowSceneDelegate
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
let splitView = UISplitViewController(style: .doubleColumn)
splitView.setViewController(PrimaryViewController(), for: .primary)
splitView.setViewController(pleaseSelectExampleViewController, for: .secondary)
window = UIWindow(windowScene: windowScene)
window?.rootViewController = splitView
window?.makeKeyAndVisible()
}
private var pleaseSelectExampleViewController: UIViewController {
let controller = UIViewController()
let label = UILabel()
label.text = "Please select one of the examples in a side menu"
controller.view.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: controller.view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: controller.view.centerYAnchor)
])
return controller
}
}