FAMapView 0.1.0

FAMapView 0.1.0

Maintained by fadi.



FAMapView 0.1.0

  • By
  • fadizant

FAMapView

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 9.0
  • use Location Description in plist
    <key>NSLocationWhenInUseUsageDescription</key>
	<string>$(EXECUTABLE_NAME) needs to access your Location</string>

How to use

FAMapView can add pin for you in map started from your location or custom location and you can make it dragable to change it, FAMapView will return pin coordinate , address or placemark info for you.

You can use FAMap by add custom class to Map Kit View or call "FAMapViewController".

Show FAMapViewController inside UINavigationController at least to can close view, FAMapViewController will show close button if there is no buttons in UINavigationBar.

Use FAMap

Objc
  • Coordinate
    _mapView.updateCoordinate = ^(CLLocationCoordinate2D coordinate) {
        NSLog(@"Coordinate = %f:%f",coordinate.latitude,coordinate.longitude);
    };
  • Coordinate and Address
    _mapView.updateCoordinateWithAdress = ^(CLLocationCoordinate2D coordinate, NSString *address) {
        NSLog(@"Address = %@",address);
    };
  • Coordinate and Placemark
    _mapView.updateCoordinateWithPlacemark = ^(CLLocationCoordinate2D coordinate, CLPlacemark *placemark) {
        NSLog(@"Country = %@ , City = %@",placemark.country,placemark.locality);
    };
Swift4
  • Coordinate
    mapView.updateCoordinate = {(coordinate) in
        print("Coordinate = \(coordinate.latitude):\(coordinate.longitude)")
    }
  • Coordinate and Address
    mapView.updateCoordinateWithAdress = {(coordinate, address) in
        print("Address = \(address ?? "")")
    }
  • Coordinate and Placemark
    mapView.updateCoordinateWithPlacemark = {(coordinate, placemark) in
        print("Country = \(placemark?.country ?? "") , City = \(placemark?.locality ?? "")")
    }

use FAMapViewController

Objc
  • Coordinate
    FAMapViewController *mapView = [[FAMapViewController alloc]initUserLocationWithDragable:YES updateCoordinate:^(CLLocationCoordinate2D coordinate) {
        NSLog(@"Coordinate = %f:%f",coordinate.latitude,coordinate.longitude);
    }];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:mapView];
    nav.title = @"pik location";
    [self presentViewController:nav animated:YES completion:nil];
  • Coordinate and Address
    FAMapViewController *mapView = [[FAMapViewController alloc]initUserLocationWithDragable:YES updateCoordinateWithAddress:^(CLLocationCoordinate2D coordinate, NSString *address) {
        NSLog(@"Address = %@",address);
    }];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:mapView];
    nav.title = @"pik location";
    [self presentViewController:nav animated:YES completion:nil];
  • Coordinate and Placemark
    FAMapViewController *mapView = [[FAMapViewController alloc]initUserLocationWithDragable:YES updateCoordinateWithPlacemark:^(CLLocationCoordinate2D coordinate, CLPlacemark *placemark) {
        NSLog(@"Country = %@ , City = %@",placemark.country,placemark.locality);
    }];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:mapView];
    nav.title = @"pik location";
    [self presentViewController:nav animated:YES completion:nil];
Swift4
  • Coordinate
    let mapView = FAMapViewController.init(userLocationCWithisDragable: true) { (coordinate) in
        print("Coordinate = \(coordinate.latitude):\(coordinate.longitude)")
    }
    if let map = mapView {
        self.navigationController?.pushViewController(map, animated: true)
    }
  • Coordinate and Address
    let mapView = FAMapViewController.init(userLocationCAWithisDragable: true) { (coordinate, address) in
        print("Address = \(address ?? "")")
    }
    if let map = mapView {
        self.navigationController?.pushViewController(map, animated: true)
    }
  • Coordinate and Placemark
    let mapView = FAMapViewController.init(userLocationCPWithisDragable: true) { (coordinate, placemark) in
        print("Country = \(placemark?.country ?? "") , City = \(placemark?.locality ?? "")")
    }
    if let map = mapView {
        self.navigationController?.pushViewController(map, animated: true)
    }

Installation

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

pod 'FAMapView'

Author

fadizant, [email protected]

License

FAMapView is available under the MIT license. See the LICENSE file for more info.