0
var textToPass: String = ""
@IBAction func modalAction(_ sender: Any) {
textToPass = textView.text
print(textToPass)
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
if let secondVC = storyBoard.instantiateViewController(withIdentifier: "SecondVC") as? SecondViewController {
present(secondVC, animated: true, completion: nil)
secondVC.textObject = textToPass // textObject = String?
}
こんにちは。 なぜこのコードでsecondVC.textObjectがnilであるのか分かりません。 教えてください。 ViewControllerをtextObjectに、次に提示2つのviewControllersの間で文字列を渡す方法は?