[Swift4]起動画面の変更
デフォルトでは初回起動画面はUIViewControllerですが、自作のViewControllerを初回起動するための方法をまとめます。
自作のViewControllerの作成
まず表示させるためのViewContorllerを作成します。

そのままだとわからないのでViewの背景を黄色に設定しておきます。
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .yellow
}
起動画面の変更
AppDelegateに起動したいViewControllerを設定します。
2行だけです!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//追加するコード
window!.makeKeyAndVisible()
window!.rootViewController = FirstViewViewController()
return true
}
シミュレータで確認!
こんな感じに表示されたら成功です
