Pretroducing… MapKit for Mac
I’ve been spending bits of time over the last few months working on a little project that I’ve not told too many people about. I’m finally at a point where I’m ready to talk about it and start showing it. I’ve been working on a clean-room re-implementation of iOS’s MapKit, but for Mac OS X.
What’s MapKit?
MapKit is a framework Apple provides with iOS that gives developers tools to easily make map based applications. It powers the Maps application, and just about every app that includes a map on iPhone/iPad. It integrates with Location Services to show where the user is, and can easily add pins to the map. It can do a lot more than that, but that’s the basics.
What do I mean by clean-room reimplementation?
I looked at the documentation available for the MapKit framework, and built a set of classes with the same names, methods, properties, etc that should work nearly identically to Apple’s MK* classes (it should be source-compatible). I’ve never worked at Apple, nor do I know any developers there, so I’ve never seen how they actually implemented MapKit. I have suspicions that mine is built quite differently than theirs though, judging by some of the issues that came up during development.
Why did I build this?
In an Mac app I’m building I wanted a Map view, and so I started exploring what kind of interaction I could get out of Google Maps and my ObjC code. Turns out I could get a lot. I quickly realized that to make this map view, I’d end up recreating about half of MapKit, so I thought “if I’m going to do half of it, I might as well do it all, and see if I can release that separately.”
What’s done so far?
The vast majority of it. All classes are there, most of them are 100% functional. All I can think of that I’m missing are the left/right accessory views on MKAnnotationView callouts, and a few delegate methods on MKMapView never get called (I can’t decide when to call mapViewWillStartLoadingMap: and friends). I have an IBPlugin for it to make it nice and easy to use.
What’s the plan?
My plan is to release this as BSD licensed code. I’m hoping that other developers can make us of it…but my intention is to have this Mac app I’m working on be the first released app with it included. At that point I’ll be making the code available, likely on GitHub for public consumption. If you’d like access to it before then (end of year), give me a shout.
Can I… can I see it?
Sure, why not. I recorded a quick little screen cast of it in action. Have a look.
Technical Information
It’s based on a WebView and Google Maps V3. It makes very heavy use of the Objective-C to Javascript scripting bridge that exists with WebKit. Google Maps doesn’t let annotations be draggable, so my annotations are actually a mix of overlays and annotations together. Annotation callouts are drawn using a canvas, and all animations you see are WebKit CSS animations.
-
gousalsa liked this
-
rickfillion posted this