Can Cocoa touch UI objects to be serialized, streamed over the network, and restored on the client?

I worked and worked with a team that was developing an iPhone app. Like many other developers new to Cocoa Touch, we decided to create a hybrid Cocoa-Web application that was essentially a few buttons that controlled some UIWebView interfaces, in part to (a) leverage existing web development experiences, in part because of (b ) the advantage is to push changes away (change stuff on the server, no need to push a new version of the app), and partly because (c) the app is inherently focused on pulling data out of the web anyway.

We have reached a point, however, where this hybrid approach looks like it has a noticeable cost versus polish and performance. We are working on this issue, but I think we all started to wonder if a cleaner Cocoa client might not be the best move.

The big question is: is there an agreement under Cocoa where we can keep the advantage (b)? Is there a way to serialize Cocoa Touch UI objects in such a way that they can be streamed over the network and restored for display on the client? If so, when they are serialized, are they light enough to be practical?

+2


source to share


2 answers


Interesting idea. You can serialize anything that implements the NSCoding protocol is what it does, so pretty much anything you can put in an XIB should allow you to archive it. You can even use UIViewController

initWithNibName:bundle:

; your application can download and deploy the package containing the nib to its document directory and then load it using the UIViewController

and method NSBundle +bundleWithPath:

. I think you might be fine with the SDK terms - they forbid loading the "plugin" code, but the XIBs don't contain anything executable.



For more information, check out the Archive Programming and Serialization Guide .

+1


source


The .xib file is a serialized representation of Objective-C objects. You can archive and unlock objects in the same way as IB does. See Docs for NSKeyedArchiver and Related Topics.



+1


source







All Articles