3 ms·
Serving an NSManagedObjectContext over an NSConnection
- tptacek 18y agoLove this blog (found it here). The idea is simple; in Ruby, you'd just be doing: class CoreDataClient def method_missing(meth, *args) @socket.write(Marshal::dump[meth, args])) l = @socket.read(4).unpack("N").first Marshal::load(@socket.read(l)) end end You get the same effect in Cocoa by setting delegates. We did used the same trick in our product to get the Subversion SWIG bindings out of our Rails processes and into a dedicated evented server we could cache in; we just replaced the SWIG interfaces with facades that turned method invocation into network messages. Huge win.