草庐IT

ios - 在 Swift 中将对象传递给 View Controller

在Objective-C中,如果您需要将对象传递给ViewController,您可以这样做:在目标.h文件中@propertyNSObject*contact;正在发送.m文件MyVC*destVC=[self.storyboardinstantiateViewControllerWithIdentifier:@"myVC"];destVC.contact=contact;[self.navigationControllerpushViewController:destVCanimated:YES];我正在尝试使用以下代码在Swift中执行此操作:letstoryBoard:UISt