A GeoJSON library for iOS, macOS, and watchOS written in Swift.
Features:
- Parse all kinds of Geometry objects
- Auto-Creates MKShape subclasses to represent your GeoJSON structure
- Allows serialising back to swift dictionary objects
- Adds useful helper methods for doing calculations with and editing GeoJSON structures
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate CubeGeoJSON into your Xcode project using Carthage, specify it in your Cartfile
:
github "3sidedcube/CubeGeoJSON" ~> 2.0.0
Then run
carthage update --use-xcframeworks
to build the framework and drag the built GeoJSON.xcframework
into your Xcode project.
- Add CubeGeoJSON as a git submodule by running the following command:
$ git submodule add https://github.com/3sidedcube/CubeGeoJSON.git
-
Open the new
CubeGeoJSON
folder, and drag theGeoJSON.xcodeproj
into the Project Navigator of your application's Xcode project.It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
-
Make sure the
GeoJSON.xcodeproj
is set up with the same deployment target as your root project. -
Add
GeoJSON.framework
as a target dependency to your project.
Initialise a new Geometry object using the default init(dictionary: [String:AnyObject)
method
import GeoJSON
let geoJSON = [
"type": "MultiPoint",
"coordinates": [
[
-105.01621,
39.57422
],
[
-80.6665134,
35.0539943
]
]
]
let geometry = Geometry(dictionary: geoJSON)
if let annotations : [MKPointAnnotation]? = geometry.shapes?.flatMap({ $0 as? MKPointAnnotation }) {
mapView.addAnnotations(annotations)
}
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D