I have an UITableView that is populated with parsed XML elements from the Internet.
All is working fine, but I’d like to separate the code to parse the XLM elements from the UIViewController that is responsible to populate this UITableView.
I’ve tried sublassing the UIViewController, but it seems to cause many coupling problems.
What’s the best way to separate this XML asynchronous parser code, and then feed its results to the UIViewController that contains the UITableView?
I don’t understand much of delegates, but is this the way to go?
Thanks!
Write an object that handles the parsing, create an instance of it in your view controller, and then call it to load up the data:
In this example, SomeXMLParser would do all the heavy lifting and pass an array back to SomeXMLParserHandler when it’s done. So in your view controller you could do something similar to this:
This isn’t working code but it should get you going in the right direction, especially if you already have the parsing code working. Also, if your into Blocks… you could swap out the protocol with a Block reference to do the work once parsing has completed.