An easy to integrate Model Based Google Maps Helper (SVHTTPClient, AFNetworking) That lets you Geo Code , Reverse Geocode, Get Directions , Places Autocomplete.

Overview

GoogleMapsHelper

Read Me in Russian : http://gargo.of.by/googlemapshelper/

A GOOGLE MAPS Helper that help you do multiple tasks like

HOW TO USE

// using AFNetworking

[[AFGoogleMapsHelper sharedAFGoogleMapsHelper] geocodeAddressString:@"Arsenal Emirates" components:@{} completionHandler:^(MOGoogleGeocodeList *googleGeoCodeList, SPGoogleGeoCoderResponse responseCode, NSString *message) {
    
}];

CLLocationCoordinate2D emiratesStadium = { 51.555747, -0.108309};
CLLocationCoordinate2D stamfordBridge = { 51.481690, -0.190999 };

[[AFGoogleMapsHelper sharedAFGoogleMapsHelper] reverseGeocodeCoordinate:(emiratesStadium) resultTypes:@[] locationTypes:@[] completionHandler:^(MOGoogleGeocodeList *googleGeoCodeList, SPGoogleGeoCoderResponse responseCode, NSString *message) {
    
}];

[[AFGoogleMapsHelper sharedAFGoogleMapsHelper] getAutoCompleteFromGoogle:@"Arsenal Emirates Stadium, london" andAutoComplete:^(MOGoogleAutoCompleteList *googleAutocompleteList, SPGoogleGeoCoderResponse responseCode, NSString *message) {
    
}];

[[AFGoogleMapsHelper sharedAFGoogleMapsHelper] getDirections:emiratesStadium andCoordinateDestination:stamfordBridge andDrawPoints:^{
    
} andPlaceMarks:^(MKPolyline *polyLine, NSString *distance, NSString *duration, NSString *startAddress, NSString *endAddress, NSMutableArray *polyLineSetArray, NSMutableArray *directionsSetArray, NSMutableArray *distanceSetArray) {
    
}];

// Using SVHTTPClient

[[SVGoogleMapsHelper sharedGoogleMapHelper] geocodeAddressString:@"Arsenal Emirates" components:@{} completionHandler:^(MOGoogleGeocodeList *googleGeoCodeList, SPGoogleGeoCoderResponse responseCode, NSString *message) {
    
}];


[[SVGoogleMapsHelper sharedGoogleMapHelper] reverseGeocodeCoordinate:(emiratesStadium) resultTypes:@[] locationTypes:@[] completionHandler:^(MOGoogleGeocodeList *googleGeoCodeList, SPGoogleGeoCoderResponse responseCode, NSString *message) {
    
}];

[[SVGoogleMapsHelper sharedGoogleMapHelper] getAutoCompleteFromGoogle:@"Arsenal Emirates Stadium, london" andAutoComplete:^(MOGoogleAutoCompleteList *googleAutocompleteList, SPGoogleGeoCoderResponse responseCode, NSString *message) {
    
}];

[[SVGoogleMapsHelper sharedGoogleMapHelper] getDirections:emiratesStadium andCoordinateDestination:stamfordBridge andDrawPoints:^{
    
} andPlaceMarks:^(MKPolyline *polyLine, NSString *distance, NSString *duration, NSString *startAddress, NSString *endAddress, NSMutableArray *polyLineSetArray, NSMutableArray *directionsSetArray, NSMutableArray *distanceSetArray) {
    
}];

1- Geocode

It returns all these items :

  • MOGoogleGeocodeList *googleGeoCodeList,
  • SPGoogleGeoCoderResponse responseCode,
  • NSString *message

I Geocode @"Arsenal Emirates" and I got Printing description of googleGeoCodeList->_results->[0]:

{ "formatted_address" = "Hornsey Rd, London N7 7AJ, UK"; geometry = { bounds = { }; location = { lat = "51.5548885"; lng = "-0.108438"; }; "location_type" = APPROXIMATE; viewport = { northeast = { lat = "51.55623748029149"; lng = "-0.107089019708498"; }; southwest = { lat = "51.5535395197085"; lng = "-0.109786980291502"; }; }; }; kMOGoogleGeocodePlacemarksAddressComponents = ( { kMOAddressComponentsTypes = ( route ); "long_name" = "Hornsey Road"; "short_name" = "Hornsey Rd"; }, { kMOAddressComponentsTypes = ( "postal_town" ); "long_name" = London; "short_name" = London; }, { kMOAddressComponentsTypes = ( "administrative_area_level_2", political ); "long_name" = "Greater London"; "short_name" = "Greater London"; }, { kMOAddressComponentsTypes = ( "administrative_area_level_1", political ); "long_name" = England; "short_name" = England; }, { kMOAddressComponentsTypes = ( country, political ); "long_name" = "United Kingdom"; "short_name" = GB; }, { kMOAddressComponentsTypes = ( "postal_code" ); "long_name" = "N7 7AJ"; "short_name" = "N7 7AJ"; } ); kMOGoogleGeocodePlacemarksTypes = ( establishment, "point_of_interest", stadium ); "place_id" = "ChIJO14pRXYbdkgRkM-CgzxxADY"; }

2- Reverse Geocode

It returns all these items :

  • MOGoogleGeocodeList *googleGeoCodeList,
  • SPGoogleGeoCoderResponse responseCode,
  • NSString *message

Printing description for first item :

<__NSArrayI 0x6080000b1b20>( { "formatted_address" = "Emirates Stadium, London, UK"; geometry = { bounds = { northeast = { lat = "51.5561569"; lng = "-0.1069905"; }; southwest = { lat = "51.5539356"; lng = "-0.1098853"; }; }; location = { lat = "51.55572979999999"; lng = "-0.1083118"; }; "location_type" = ROOFTOP; viewport = { northeast = { lat = "51.5563952302915"; lng = "-0.1069905"; }; southwest = { lat = "51.5536972697085"; lng = "-0.1098853"; }; }; }; kMOGoogleGeocodePlacemarksAddressComponents = ( { kMOAddressComponentsTypes = ( premise ); "long_name" = "Emirates Stadium"; "short_name" = "Emirates Stadium"; }, { kMOAddressComponentsTypes = ( locality, political ); "long_name" = London; "short_name" = London; }, { kMOAddressComponentsTypes = ( "postal_town" ); "long_name" = London; "short_name" = London; }, { kMOAddressComponentsTypes = ( "administrative_area_level_2", political ); "long_name" = "Greater London"; "short_name" = "Greater London"; }, { kMOAddressComponentsTypes = ( "administrative_area_level_1", political ); "long_name" = England; "short_name" = England; }, { kMOAddressComponentsTypes = ( country, political ); "long_name" = "United Kingdom"; "short_name" = GB; } ); kMOGoogleGeocodePlacemarksTypes = ( premise ); "place_id" = ChIJuaX4rXcbdkgRX7nJ4iCVzT0; }} )

3- Autocomplete

It Returns all of these items :

  • MOGoogleAutoCompleteList *googleAutocompleteList,
  • SPGoogleGeoCoderResponse responseCode,
  • NSString *message

I wanted to search @"Arsenal Emirates Stadium, london" and I got following 2 results, I am showing first item

Printing description of ((MOPredictions *)0x0000600000282b70): { description = "Arsenal Football Club, Emirates Stadium, Hornsey Road, London, United Kingdom"; id = 695fdbc199ef136a3674dc5c3946d0901be24cf2; kMOPredictionsMatchedSubstrings = ( { length = 7; offset = 0; }, { length = 16; offset = 23; }, { length = 6; offset = 55; } ); kMOPredictionsTerms = ( { offset = 0; value = "Arsenal Football Club"; }, { offset = 23; value = "Emirates Stadium"; }, { offset = 41; value = "Hornsey Road"; }, { offset = 55; value = London; }, { offset = 63; value = "United Kingdom"; } ); kMOPredictionsTypes = ( establishment ); "place_id" = ChIJq3Y4mXYbdkgRinA5RgGR5tA; reference = "CmRcAAAA3_03PcjmlvYYAMB56q1NSPHAa6o4s5OZlZzmqKWVzl6m8wQu8kIAHqSFzY8M_fJC6tbdt5vQSOylmlp6vu8hMJ0areyjFCiETtOb2e1qkM9a8TbnHRoIGK83-h0iy9EaEhCgUDC5ODRWWeKhZZmXh3wHGhRRAUwm4UFKR6a689AJXsADrqKFNA"; }

4- Directions

It Returns All these Items :

  • MKPolyline *polyLine,
  • NSString *distance,
  • NSString *duration,
  • NSString *startAddress,
  • NSString *endAddress,
  • NSMutableArray *polyLineSetArray,
  • NSMutableArray *directionsSetArray,
  • NSMutableArray *distanceSetArray in a block.

I found directions between following CLLocationCoordinate2D's CLLocationCoordinate2D emiratesStadium = { 51.555747, -0.108309}; CLLocationCoordinate2D stamfordBridge = { 51.481690, -0.190999 };

Printing description of duration:

42 mins

Printing description of distance:

16.6 km

Printing description of startAddress:

Citizen Rd, London N7, UK

Printing description of endAddress:

19 Billing Pl, London SW10 9UN, UK

Plus Polyline object to be used in MKMapView

It also tells you Guidance strings which you can use :

  • Head southwest on Citizen Rd toward Hornsey Rd/A103,
  • Turn right onto Hornsey Rd/A103,
  • Turn left onto Tollington Rd/A503Continue to follow A503,
  • Continue straight onto Camden Rd/A503,
  • Turn left onto Camden St/A400Continue to follow A400,
  • Turn left onto Hampstead Rd/A400Continue to follow A400,
  • Turn right onto Euston Rd,
  • Merge onto Euston Rd/A501 via the ramp to Ring Road/A41/A40/KilburnContinue to follow A501,
  • Keep right to continue on Marylebone Flyover/A40Continue to follow A40,
  • Take the A3220 ramp to Hammersmith/Shepherd's Bush/White City/Earls Court,
  • At the roundabout, take the 1st exit onto W Cross Rte/A3220,
  • At the roundabout, take the 2nd exit onto Holland Rd/A3220Continue to follow A3220,
  • Keep right to continue on Warwick Gardens/A3220,
  • Turn left onto Pembroke Rd/A3220Continue to follow A3220,
  • Continue straight onto Earls Ct Rd/A3220Continue to follow A3220,
  • Turn right onto Fulham Rd/A308Continue to follow Fulham Rd,
  • Turn right,
  • Turn right,
  • Turn left
  • Destination will be on the left

Make sure you integrate AFNetworking, SVProgressHUD, SVHTTPClient

I was using CocoaPods so I used

  • pod 'SVHTTPRequest', '~> 0.5'
  • pod 'AFNetworking', '~> 3.0'
  • pod 'SVProgressHUD'

Dont forget to add condition in info.plist

  • App Transport > Arbitrary loads allow : YES
You might also like...
Get your device ip address, router ip or wifi ssid
Get your device ip address, router ip or wifi ssid

FGRoute FGRoute is written on C and Objective C (includes Swift support), it helps developers to get rid of dealing with WiFi interfaces. Example To r

A frida tool that capture GET/POST HTTP requests of iOS Swift library 'Alamofire' and disable SSL Pinning.
A frida tool that capture GET/POST HTTP requests of iOS Swift library 'Alamofire' and disable SSL Pinning.

FridaHookSwiftAlamofire A frida tool that capture GET/POST HTTP requests of iOS Swift library 'Alamofire' and disable SSL Pinning. 中文文档及过程 Features Ca

Swift HTTP server using the pre-fork worker model

Curassow Curassow is a Swift Nest HTTP Server. It uses the pre-fork worker model and it's similar to Python's Gunicorn and Ruby's Unicorn. It exposes

DBNetworkStack is a network abstraction for fetching request and mapping them to model objects

DBNetworkStack Main Features 🛡 Typed network resources 🏠 Value oriented architecture 🔀 Exchangeable implementations 🚄 Extendable API 🎹 Composable

A light weight network library with automated model parser for rapid development

Gem A light weight network library with automated model parser for rapid development. Managing all http request with automated model parser calls in a

Swift guarded model initializers for SwiftyJSON

GuardedSwiftyJSON Why should I use this? This library makes initializing models with JSON data with SwiftyJSON a lot easier. Often with SwiftyJSON I e

A native, lightweight and secure time-based (TOTP) & counter-based (HOTP) password client built for iOS
A native, lightweight and secure time-based (TOTP) & counter-based (HOTP) password client built for iOS

A native, lightweight and secure time-based (TOTP) & counter-based (HOTP) password client built for iOS Built by Tijme Gommers – Buy me a coffee via P

Swift based OAuth library for iOS
Swift based OAuth library for iOS

OAuthSwift Swift based OAuth library for iOS and macOS. Support OAuth1.0, OAuth2.0 Twitter, Flickr, Github, Instagram, Foursquare, Fitbit, Withings, L

Super lightweight web framework in Swift based on SWSGI

Ambassador Super lightweight web framework in Swift based on SWSGI Features Super lightweight Easy to use, designed for UI automatic testing API mocki

Comments
  • Readme translation

    Readme translation

    Hello I have translated readme file into Russian. Could you please add a link to page with this transation into your readme?

    http://gargo.of.by/googlemapshelper/

    opened by Gargo 1
Owner
Zeeshan Haider
Founder of AsappStudio Full Stack and Mobile Development experts PHP Java C# JavaScript NodeJS React Angular VueJS NestJS MongoDB PostGreSQL MySQL MSSQL
Zeeshan Haider
YTKNetwork is a high level request util based on AFNetworking.

YTKNetwork What YTKNetwork is a high level request util based on AFNetworking. It's developed by the iOS Team of YuanTiKu. It provides a High Level AP

猿辅导技术团队 6.5k Jan 6, 2023
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking.

XMNetworking English Document XMNetworking 是一个轻量的、简单易用但功能强大的网络库,基于 AFNetworking 3.0+ 封装。 其中,XM 前缀是我们团队 Xcode-Men 的缩写。 简介 如上图所示,XMNetworking 采用中心化的设计思想

KANGZUBIN 981 Dec 29, 2022
The perfect accessory for Mantle and AFNetworking.

Overcoat We are finding maintainers, contact @sodastsai :) Overcoat is a small but powerful library that makes creating REST clients simple and fun. I

null 1.1k Dec 2, 2022
A custom wrapper over AFNetworking library that we use inside RC extensively

AFNetworkingHelper A very simple wrapper over the most amazing networking library for objective C, AFNetworking. We extensively use it inside RC and i

Betacraft 16 Aug 3, 2021
Synchronous requests for AFNetworking 1.x, 2.x, and 3.x

AFNetworking-Synchronous A minimal category which extends AFNetworking to support synchronous requests. Usage 3.x pod 'AFNetworking', '~> 3.0' pod

Paul Melnikow 160 Dec 7, 2022
Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data. Javascript / iOS glue framework

Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data. Javascript / iOS glue framework

glassfy 5 Nov 7, 2022
iONess is HTTP Request Helper for iOS platform used by HCI iOS App

iONess iONess (iOS Network Session) is HTTP Request Helper for the iOS platform used by Home Credit Indonesia iOS App. It uses Ergo as a concurrent he

OSFE Homecredit Indonesia 1 Mar 28, 2022
Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Igor 2 Sep 16, 2022
Google ProtocolBuffers for Apple Swift

Protocol Buffers for Swift An implementation of Protocol Buffers in Swift. Protocol Buffers are a way of encoding structured data in an efficient yet

Alexey Khokhlov 933 Nov 4, 2022
Access the native iOS / macOS reminders (get, update, delete) in TiDev / Titanium.

Titanium iOS Reminders API Access the native iOS reminders (get, update, delete) in TiDev / Titanium. Requirements The NSRemindersUsageDescription pri

Hans Knöchel 5 Nov 28, 2021