The ABFRealmMapView
class creates an interface object that inherits MKMapView
and manages real-time fetching and displaying annotations for a Realm object class that contains coordinate data. In addition, by default the map view clusters annotations based on zoom level.
This allows for the creation of a map interface with as little as no code via Interface Builder!
Realm Swift support was added in version 1.4 with an identical API.
Did you find this library and haven't heard of Realm?
The quick overview is that Realm is a replacement to Core Data or SQLite. It is extremely fast (enabling the instant map searching and clustering) and free to use. For more details head over to Realm.
The demo app uses RealmSFRestaurantData to search through restaurants in San Francisco.
-
Add
MKMapView
to your Xib or storyboard and replace the class withABFRealmMapView
(RealmMapView
for Swift version) -
Adjust the Realm Map View properties to specify the fetched Realm entity name and key paths for latitude, longitude, and annotation view title and subtitles.
3. That's It!
If you still have questions, a slightly longer tutorial is available here
Objective-C Click Here
Swift Click Here
ABFRealmMapView
is available through CocoaPods. To install
it, simply add the following line to your Podfile:
Starting with Xcode 7.1, there is an issue with CocoaPods 0.39 that caused the interop of the Objective-C code for ABFRealmMapView
to fail on compile when used in RealmMapView
. This problem has now been resolved as of v1.6.6. Please be sure to use this version or higher with Xcode 7.1.
Objective-C
pod 'ABFRealmMapView'
Swift
use_frameworks!
pod 'RealmMapView'
Build and run/test the Example project in Xcode to see ABFRealmMapView
in action. This project uses CocoaPods. If you don't have CocoaPods installed, grab it with [sudo] gem install cocoapods.
Objective-C
git clone https://github.com/bigfish24/ABFRealmMapView.git
cd ABFRealmMapView/ABFRealmMapViewExample
pod install
open ABFRealmMapView.xcworkspace
- iOS 7+
- Xcode 6
Swift
git clone https://github.com/bigfish24/ABFRealmMapView.git
cd ABFRealmMapView/SwiftExample
pod install
open RealmMapViewExample.xcworkspace
- iOS 8+
- Xcode 7