Giter VIP home page Giter VIP logo

mapir-ios-maps-sdk's Introduction

Map.ir Map Kit

Map.ir Map Kit is an interactive map based on Mapbox framework, providing Map.ir tiles.

Features

  • Supports Swift and Objective-C
  • Customizable map and gestures.
  • Interface similar to Apple's MapKit.
  • Support for Interface builder.
  • Automatic switch to dark mode with sunset/sunrise ro when the system's theme updates.
  • All with Map.ir vector and raster tiles.

Example

To see the example application, first run git clone https://github.com/map-ir/mapir-ios-maps-sdk in terminal. Open MapirMapKit.xcodeproj. Build and run Mapir MapKit Example target. Every view controller demonstrates a feature of the map. More examples will be available soon.

Installation

Cocoapods

Map.ir Map Kit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MapirMapKit' 

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

To integrate Map.ir Map Kit into your Xcode project using Carthage, specify it in your Cartfile:

github "map-ir/mapir-ios-maps-sdk"

Run carthage update to build the frameworks and drag the built MapirLiveTracker.framework and Mapbox.framework into your Xcode project.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase” and add the following line:

/usr/local/bin/carthage copy-frameworks

Add MapirMapKit.framework and Mapbox.framework as input files:

$(SRCROOT)/Carthage/Build/iOS/MapirMapKit.framework
$(SRCROOT)/Carthage/Build/iOS/Mapbox.framework
$(SRCROOT)/Carthage/Build/iOS/MapboxMobileEvents.framework

See Carthage Getting started Step 4, 5 and 6 for more details.

Usage

This SDK is compatible with both Swift and Objective-C programming languages, using iOS 9.0 or newer.

first import Map.ir MapKit.

import MapirMapKit
#import <MapirMapKit/MapirMapKit.h>

In order to use Map.ir tiles, you need to specifiy you API key in your project's Info.plist file with MAPIRAPIKey (older versions used MAPIRAccessToken key It's still supported by the SDK but we recommend to update the key to MAPIRAPIKey).

<key>MapirAPIKey</key>
<string><YOUR_API_KEY></string>

Then use initializers for of SHMapView to create an instance of it. SHMapView is the subclass of MGLMapView with Map.ir tiles. To receive updates related to the map, such as events about loading of the style, your should specify a delegate object for the map view, set the delegate class right after when you create the instance of SHMapView. To create instansiate SHMapView and specifying its delegate see code below:

class ViewController: UIViewController {

    var mapView: SHMapView!

    override func viewDidLoad() { 
        super.viewDidLoad()
        
        mapView = SHMapView(frame: view.bounds)
        mapView.delegate = self
    }
    ...
}

extension ViewController: SHMapViewDelegate {
    // Define delegate methods here.
}

In your view controller's header file:

@interface ViewController : UIViewController <SHMapViewDelegate>

@property (nonatomic, strong) SHMapView *mapView;

@end

In your view controller's implementation file:

@implementation

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    mapView = [[SHMapView alloc] initWithFrame:self.view.bounds];
    [mapView setDelegate:self];
}

// Define delegate methods here.

@end

Contributing

Contributions are very welcome. 🙌

mapir-ios-maps-sdk's People

Contributors

mr-alirezaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.