Latest 1.0.0
Homepage https://github.com/NAXAM/ios-nativeplacepicker
License MIT
Platforms ios 8.0, requires ARC
Authors

iOS – MapKit PlacePicker

iOS PlacePicker using entirely MapKit, CoreLocation

Picker Search Confirm

Installation

CocoaPods

target 'MyApp' do
    pod "NXPlacePicker"
end

Nuget

Install-Package Naxam.iOS.PlacePicker

How to use

import UIKit
import AddressBookUI

class ViewController: UIViewController , NXPlacePickerDelegate{

    @IBOutlet weak var btnPickPlace: UIButton!
    @IBOutlet weak var lblSelectedPlace: UILabel!

    @IBAction func doPickPlace(_ sender: UIButton) {
        let vc = NXPlacePickerViewController.initWith(self)

        self.present(vc, animated: true, completion: nil)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    }

    // NXPlacePickerDelegate
    func placePicker(_ viewController: NXPlacePickerViewController, didSelectPlace place: MKPlacemark) {
        viewController.dismiss(animated: true, completion: nil)
        lblSelectedPlace.text = ABCreateStringWithAddressDictionary(place.addressDictionary!, false)
        print(place)
    }

}

“`C#
using System;
using System.Collections.Generic;
using Foundation;
using MapKit;
using Naxam.iOS.PlacePicker;
using UIKit;

namespace DemoBindingNXPlacePicker
{
public partial class ViewController : UIViewController, INXPlacePickerDelegate
{
protected ViewController(IntPtr handle) : base(handle)
{
// Note: this .ctor should not contain any initialization logic.
}

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        // Perform any additional setup after loading the view, typically from a nib.

        btnSelectPlace.TouchUpInside += delegate {
            NXPlacePickerViewController vc = NXPlacePickerViewController.InitWithDelegate(this);
            this.PresentViewController(vc, true, null);
        };
    }

    public override void ViewDidAppear(bool animated)
    {
        base.ViewDidAppear(animated);
    }

    public override void DidReceiveMemoryWarning()
    {
        base.DidReceiveMemoryWarning();
        // Release any cached data, images, etc that aren't in use.
    }

    // INXPlacePickerDelegate
    public void DidSelectPlace(NXPlacePickerViewController viewController, MKPlacemark place)
    {
        viewController.DismissViewController(true, null);
        var addressLines = place.AddressDictionary["FormattedAddressLines"] as NSArray;
        lblSelectedPlace.Text = string.Join(", ", (IEnumerable<NSString>)NSArray.FromArray<NSString>(addressLines));
        //throw new NotImplementedException();
    }
}

}

Latest podspec

{
    "name": "NXPlacePicker",
    "version": "1.0.0",
    "summary": "iOS PlacePicker using entirely MapKit, CoreLocation",
    "description": "iOS PlacePicker using entirely MapKit and CoreLocation",
    "homepage": "https://github.com/NAXAM/ios-nativeplacepicker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "NAXAM CO., LTD": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/NAXAM/ios-nativeplacepicker.git",
        "commit": "7bf8a419476d3b8fca1f49f007e2afb6674c150f"
    },
    "source_files": "NXPlacePicker/NXPlacePicker/**/*.{h,m}",
    "exclude_files": [
        "xam-binding",
        "NXPlacePickerQs"
    ],
    "weak_frameworks": "MapKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This