我在parentviewcontroller
收到Json回复,我想将该回复中的数组值传递给childviewcontroller
。
答案 0 :(得分:0)
试试这种方式
class parentVC: UIViewController {
...
let childController = UIStoryboard(name: "Storyboard-Name", bundle: nil).instantiateViewController(withIdentifier: "Child Viewcontroller Id") as? ChildVC
childController.arrayFromParent = arrayToPass //You can pass value to a variable in child viewcontroller.
}
class ChildVC: UIViewController {
var arrayFromParent = [String]()
...
}