複数のストーリーボード

複数のストーリーボードを使って、NavigationControllerで画面遷移する場合

①ストーリーボードを追加する(今回、ファイル名はStoryboard.storyboard)

②identity inspectorで、対応するViewControllerとStoryboard ID を設定する。

f:id:ichi6161:20180107000615p:plain

③コードを追加

//定数にストーリーボードのファイル名を指定
let storyboard: UIStoryboard = UIStoryboard(name: "Storyboard", bundle: nil)

//ここで、ストーリーボードとViewControllerを結びつけ
let next = storyboard.instantiateViewController(withIdentifier:"Storyboard") as?ToDoViewController
  
//画面遷移
self.navigationController?.pushViewController(next!, animated: true)

以上