Mc.Stever Mc.Stever - 1 year ago 78
Objective-C Question

how to pass multiple objects back to parent viewcontroller with delegate?

I am using the delegate method to pass data back to the parent with a statement such as

[self.delegate viewControllerDismissed:data1];

This works well. Now I have a need to send more data. Can I use something like

[self.delegate viewControllerDismissed:data1 with:data2];

And if so, what does the protocol etc look like? Or do I just pass everything back through and array? I can't find any examples with two parameters

Answer Source

use the model of data or array or dictionary example in swift what i am using

class Place: NSObject {
  var placeId: String = ""
  var primaryText: String = ""
  var secondaryText: String = ""
  var latitude: Double = 0
  var longitude: Double = 0

then call delegate method with created place

delegate?.didSelectPlace(place: placeObject)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download