siwft メモリーリークエラー対応 画面遷移
問題
問題のコード
@IBAction func logSettingButtonTapped(_ sender: Any) { let storyboard = UIStoryboard(name: "LogSetting", bundle: nil) let nextVC = storyboard.instantiateInitialViewController()! nextVC.modalPresentationStyle = .fullScreen present(nextVC, animated: true, completion: nil) }
画面遷移はする。しかし、どんどんインスタンスを生成してしまう
fix
@IBAction func logSettingButtonTapped(_ sender: Any) { tabBarController?.selectedIndex = 0 }
この記事が参考になる
https://stackoverflow.com/questions/38215738/navigation-controller-with-tab-bar-controller