I have an object that I want to segue between two MVC’s. Do the properties in the first MVC get segued along with the object or is it only the methods. IE: if I have an int property with the value 5 and then perform a segue passing the object. Will my new MVC have access to this property and the value 5? or will it only have access to the passed objects methods?
Share
Properties are not passed or set on the destination viewController in a segue. If you want your destination viewController to use an object (instance of a class) or some simple variable, you must define that property in your destination viewController class and then set it in
prepareForSegue:For example, in the code bit below, the destination viewController has a property ‘sectionToShow’ and the setter for that property is being called.Another approach is to define a delegate for the destination viewController and set it in the same way. Then the destination viewController can call the methods and access the properties of the delegate.