지도는 UIView의 서브클래스인 GMSMapView 클래스에 의해 API에서 표현됩니다. 지도는 iOS용 Maps SDK의 가장 중요한 객체이며 마커, 다중선 등의 다른 객체를 추가, 삭제, 관리하는 데 필요한 메서드를 제공합니다.
소개
iOS용 Maps SDK를 사용하면 iOS 애플리케이션에 Google 지도를 표시할 수 있습니다. 이 지도는 Google 지도 iOS 앱에 표시되는 지도와 모양이 동일하며 SDK에서 다수의 동일한 기능을 노출합니다.
매핑 기능 외에도 API에서는 iOS UI 모델과 일치하는 다양한 상호작용을 지원합니다. 예를 들어 탭, 더블 탭과 같은 사용자 동작에 반응하는 응답자를 정의하여 지도와의 상호작용을 설정할 수 있습니다.
지도 객체를 사용할 때 주요 클래스는 GMSMapView 클래스입니다.
GMSMapView는 다음 작업을 자동으로 처리합니다.
Google 지도 서비스에 연결
지도 타일 다운로드
기기 화면에 타일 표시
화면 이동 및 확대/축소와 같은 다양한 컨트롤 표시
화면 이동 및 확대/축소 동작 시 지도를 이동하거나 확대/축소하여 응답
지도의 보기 각도를 기울여 두 손가락 동작에 응답합니다.
이러한 자동 작업 외에 GMSMapView 클래스에서 노출하는 속성과 메서드를 통해 지도의 동작과 모양을 제어할 수 있습니다. GMSMapView를 사용하여 마커, 지상 오버레이, 다중선을 추가 및 삭제하고, 표시되는 지도 유형을 변경하고, GMSCameraPosition 클래스를 통해 지도에 표시되는 항목을 제어합니다.
SwiftUI로 지도 빌드하기
SwiftUI는 선언적 접근 방식을 사용하여 UI를 만드는 추가 방법을 제공합니다. SwiftUI에 뷰가 다양한 다양한 상태와 함께 어떻게 표시되는지 확인할 수 있으며, 나머지는 시스템에서 자동으로 처리합니다. SwiftUI는 이벤트 또는 사용자 작업에 의해 기본 상태가 변경될 때마다 뷰 업데이트를 처리합니다.
iOS용 Maps SDK는 UIKit를 기반으로 빌드되며 SwiftUI 호환 뷰를 제공하지 않습니다. SwiftUI에서 지도를 추가하려면 UIViewRepresentable 또는 UIViewControllerRepresentable를 준수해야 합니다. 자세한 내용은 Codelab SwiftUI로 iOS 앱에 지도 추가하기를 참고하세요.
지도 추가
지도를 추가하는 기본 단계는 다음과 같습니다.
SDK를 가져오고, API 키를 획득하고, 필수 프레임워크를 추가하려면 다음 단계를 따르세요.
AppDelegate에서 GMSServices의 provideAPIKey: 클래스 메서드에 API 키를 제공합니다.
ViewController를 만들거나 업데이트합니다. 이 뷰 컨트롤러가 표시될 때 지도가 표시되는 경우 viewDidLoad 메서드 내에서 지도를 만들어야 합니다.
지도 뷰를 초기화할 때 GMSMapViewOptions로 구성 옵션을 설정합니다. 속성에는 frame, camera, mapID,backgroundColor 또는 screen이 포함됩니다.
GMSCameraPosition 객체를 사용하여 지도 옵션camera 속성을 설정합니다. 지도의 중심과 확대/축소 수준을 지정합니다.
GMSMapViewoptions: 메서드를 사용하여 GMSMapView 클래스를 만들고 인스턴스화합니다. 이 지도가 뷰 컨트롤러의 유일한 뷰로 사용되는 경우 지도 옵션 frame의 기본값인 CGRectZero를 뷰 frame로 사용할 수 있습니다. 지도의 크기가 자동으로 조정됩니다.
GMSMapView 객체를 뷰 컨트롤러의 뷰로 설정합니다. 예를 들면 self.view = mapView;입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eThe Maps SDK for iOS allows you to integrate Google Maps into your iOS application, offering features and interactions similar to the Google Maps app.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSMapView\u003c/code\u003e is the primary class for working with maps, handling tasks like connecting to Google Maps, downloading tiles, and responding to user gestures.\u003c/p\u003e\n"],["\u003cp\u003eTo add a map, obtain an API key, configure the \u003ccode\u003eGMSMapView\u003c/code\u003e object with desired settings like camera position and frame, and then set it as the view controller's view.\u003c/p\u003e\n"],["\u003cp\u003eSwiftUI integration requires using \u003ccode\u003eUIViewRepresentable\u003c/code\u003e or \u003ccode\u003eUIViewControllerRepresentable\u003c/code\u003e due to the SDK being built on \u003ccode\u003eUIKit\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAfter adding the map, you can further configure its settings to customize its appearance and behavior.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\nSelect platform: [Android](/maps/documentation/android-sdk/map \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/map \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/maptypes \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\n| **Note:** This document describes how to add a Google Map to an iOS application. If you would like to know how to launch the Google Maps standalone application, refer to the [URL Scheme](/maps/documentation/ios-sdk/urlscheme) documentation.\n\nMaps are represented in the API by the [`GMSMapView`](/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView) class, a\nsubclass of `UIView`. The map is the most significant object in the\nMaps SDK for iOS, and provides necessary methods for adding, removing\nand managing other objects such as markers and polylines.\n\nIntroduction\n\nThe Maps SDK for iOS lets you to display a Google map in\nyour iOS application. These maps have the same appearance as the maps you see in\nthe [Google Maps](https://itunes.apple.com/app/id585027354)\niOS app, and the SDK exposes many of the same features.\n\nIn addition to mapping functionality, the API also supports a range of\ninteractions that are consistent with the iOS UI model. For example, you can set\nup interactions with a map by defining responders that react to user gestures,\nsuch as tap and double-tap.\n\nThe key class when working with a Map object is the `GMSMapView` class.\n`GMSMapView` handles the following operations automatically:\n\n- Connecting to the Google Maps service.\n- Downloading map tiles.\n- Displaying tiles on the device screen.\n- Displaying various controls such as pan and zoom.\n- Responding to pan and zoom gestures by moving the map and zooming in or out.\n - Responding to two finger gestures by tilting the viewing angle of the map.\n\nIn addition to these automatic operations, you can control the behavior and\nappearance of the map through the properties and methods exposed by the\n`GMSMapView` class. Use `GMSMapView` to add and remove markers, ground\noverlays and polylines, change the type of map that is displayed, and control\nwhat is shown on the map through the [`GMSCameraPosition`](/maps/documentation/ios-sdk/reference/objc/Classes/GMSCameraPosition)\nclass.\n\nBuild Maps with SwiftUI\n\nSwiftUI offers an additional way to create UI using a declarative approach. You\ntell SwiftUI how you want your view to look along with all the different states\nfor it, and the system does the rest. SwiftUI handles updating the view whenever\nthe underlying state changes due to an event or user action.\n\nMaps SDK for iOS is built on top of `UIKit` and doesn't provide a\nSwiftUI-compatible view. Adding maps in SwiftUI requires conforming to either\n`UIViewRepresentable` or `UIViewControllerRepresentable`. To learn more, see the\nCodelab [adding a map to your iOS app with\nSwiftUI](/codelabs/maps-platform/maps-platform-ios-swiftui#0).\n\nAdd a map\n\nThe basic steps for adding a map are:\n\n1. To get the SDK, obtain an API key, and add the required frameworks, follow\n the steps in:\n\n 1. [Set Up in the Google Cloud console](/maps/documentation/ios-sdk/cloud-setup)\n\n 2. [Use an API key](/maps/documentation/ios-sdk/get-api-key)\n\n 3. [Set up an Xcode Project](/maps/documentation/ios-sdk/config)\n\n 4. In your `AppDelegate`, provide your API key to the `provideAPIKey:`\n class method on `GMSServices`.\n\n 5. Create or update a `ViewController`. If the map is displayed when this\n view controller becomes visible, be sure to create it within the\n `viewDidLoad` method.\n\n 6. When initializing your map view, set configuration options with\n `GMSMapViewOptions`. Properties include the `frame`, `camera`,\n `mapID`,`backgroundColor` or `screen`.\n\n 7. Set your [map options](/maps/documentation/ios-sdk/configure-map#map_options) `camera` property with a\n `GMSCameraPosition` object. This specifies the center and zoom level of\n the map.\n\n 8. Create and instantiate a `GMSMapView` class using the `GMSMapView`\n `options:` method. If this map is to be used as the view controller's\n only view, the map option `frame` default value of `CGRectZero` can be\n used as the view `frame` --- the map is resized automatically.\n\n 9. Set the `GMSMapView` object as the view controller's view. For example,\n `self.view = mapView;`.\n\nThe below example adds a map, centered at downtown Singapore, to an app. \n\nSwift \n\n```swift\nimport GoogleMaps\n\nclass MapObjects : UIViewController {\n override func viewDidLoad() {\n super.viewDidLoad()\n\n let options = GMSMapViewOptions()\n options.camera = GMSCameraPosition(latitude: 1.285, longitude: 103.848, zoom: 12)\n options.frame = self.view.bounds;\n\n let mapView = GMSMapView(options:options)\n self.view = mapView\n }\n}\n```\n\nObjective-C \n\n```objective-c\n- (void)viewDidLoad {\n [super viewDidLoad];\n\n GMSMapViewOptions *options = [[GMSMapViewOptions alloc] init];\n options.camera = [GMSCameraPosition cameraWithLatitude:1.285\n longitude:103.848\n zoom:12];\n options.frame = self.view.bounds;\n\n GMSMapView *mapView = [[GMSMapView alloc] initWithOptions:options];\n self.view = mapView;\n}\n```\n\nOnce you've followed these steps, you may further configure the `GMSMapView`\nobject.\n\nWhat's next\n\nAfter you complete these steps, you can [configure the map\nsettings](/maps/documentation/ios-sdk/configure-map)."]]