Archive for June, 2012

Created SyncKitTouch for Better Code Sharing to iOS

Monday, June 4th, 2012

xcode.jpg

This morning I finally put the finishing touches on the first good cut of SyncKitTouch - the iOS library based on the AppKit Library, SyncKit that I had built for a project Joel and I are working on. It's a simple cloud synchronization scheme where we know the data that's getting synced, and the database in the cloud is a peer to the clients on iOS and OS X. The interesting part of this is that I didn't initially expect to have to build a second version of the library - I thought that all the NSDataSources and ComboBox DataSources were going to be used on both platforms. Oh no, no, no… That would make too much sense.

It seems that the data sources, while pretty much functionally the same, they aren't actually the same, and since the headers for one platform don't exist on the other, the best way I found to make the code as reusable as possible is to have the complete library in one project/target, and then put the AppKit-specific DataSources into categories on the appropriate classes. Then in the UIKit-based 'touch' library, I simply included all the classes - and re-implemented the categories this time using UIKit DataSources and Controllers.

It wasn't too bad, as most of the code was in the original library, and while it's recompiled, it's not duplicated in the project, and that means change it in one place, and that's it. Much better than making a complete duplicate of the library - or making three - one for the base functionality, one for the AppKit extensions, and another for the UIKit extensions. That's too much - better to have two - one that's "Touch", and one that's not.

So I got all the code in and compiling - but I haven't really create a SyncKitTickle app to try it out. I'm just not sure how this will look and function. I'm hoping Joel can give me a few ideas there. If he does, the next thing will be to make SyncKitTickle and start trying this out on the simulator, etc. Just to make sure that what I'm building is really working as it should.

Still… it's a nice milestone to get done and send back to Joel.