Last active
April 5, 2018 14:15
-
-
Save koogawa/5071555 to your computer and use it in GitHub Desktop.
Google Maps SDK for iOS の使い方(Swift 4対応) ref: https://qiita.com/koogawa/items/adc2dd19015586bda39b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://github.com/CocoaPods/Specs.git' | |
| target 'YOUR_APPLICATION_TARGET_NAME_HERE' do | |
| pod 'GoogleMaps' | |
| pod 'GooglePlaces' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapView_.mapType = kGMSTypeSatellite; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import GoogleMaps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GMSMarkerOptions *markerOptions = [[GMSMarkerOptions alloc] init]; | |
| markerOptions.position = CLLocationCoordinate2DMake(35.6662026, 139.7312591); | |
| markerOptions.title = @"東京ミッドタウン"; | |
| markerOptions.snippet = @"東京都港区赤坂9−7−1"; | |
| [self.mapView addMarkerWithOptions:markerOptions]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapView_.mapType = kGMSTypeSatellite; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let marker = GMSMarker() | |
| marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20) | |
| marker.title = "Sydney" | |
| marker.snippet = "Australia" | |
| marker.map = mapView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GMSMarkerOptions *markerOptions = [[GMSMarkerOptions alloc] init]; | |
| markerOptions.position = CLLocationCoordinate2DMake(-33.86, 151.20); | |
| markerOptions.title = @"Sydney"; | |
| markerOptions.snippet = @"Australia"; | |
| markerOptions.map = mapView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(id<GMSMarker>)marker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func mapView(_ mapView: GMSMapView, didTapInfoWindowOf marker: GMSMarker) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)mapView:(GMSMapView *)mapView | |
| didTapInfoWindowOfMarker:(id<GMSMarker>)marker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let path = GMSMutablePath() | |
| path.add(CLLocationCoordinate2D(latitude:37.36, longitude: -122.0)) | |
| path.add(CLLocationCoordinate2D(latitude:37.45, longitude: -122.0)) | |
| path.add(CLLocationCoordinate2D(latitude:37.45, longitude: -122.2)) | |
| path.add(CLLocationCoordinate2D(latitude:37.36, longitude: -122.2)) | |
| path.add(CLLocationCoordinate2D(latitude:37.36, longitude: -122.0)) | |
| let rectangle = GMSPolyline(path: path) | |
| rectangle.map = mapView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GMSMutablePath *path = [GMSMutablePath path]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(37.36, -122.0)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(37.45, -122.0)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(37.45, -122.2)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(37.36, -122.2)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(37.36, -122.0)]; | |
| GMSPolyline *rectangle = [GMSPolyline polylineWithPath:path]; | |
| rectangle.map = mapView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import GoogleMaps; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(id<GMSMarker>)marker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GMSServices.provideAPIKey("YOUR_API_KEY") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)mapView:(GMSMapView *)mapView | |
| didTapInfoWindowOfMarker:(id<GMSMarker>)marker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [GMSServices provideAPIKey:@"YOUR_API_KEY"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GMSPolylineOptions *rectangle = [GMSPolylineOptions options]; | |
| GMSMutablePath *path = [GMSMutablePath path]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(35.6662026, 139.7312591)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(35.6762026, 139.7312591)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(35.6762026, 139.7412591)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(35.6662026, 139.7412591)]; | |
| [path addCoordinate:CLLocationCoordinate2DMake(35.6662026, 139.7312591)]; | |
| rectangle.path = path; | |
| [self.mapView addPolylineWithOptions:rectangle]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6.0) | |
| let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera) | |
| view = mapView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 | |
| longitude:151.20 | |
| zoom:6]; | |
| GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; | |
| self.view = mapView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapView.isMyLocationEnabled = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapView.myLocationEnabled = YES; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mapView.mapType = .satellite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment