Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit ebb7758

Browse files
aoinakanishiamirh
authored andcommitted
Add Swift example to README.md for google_maps_flutter (#1161)
1 parent 0132666 commit ebb7758

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/google_maps_flutter/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ Specify your API key in the application delegate `ios/Runner/AppDelegate.m`:
5757
@end
5858
```
5959
60+
Or in your swift code, specify your API key in the application delegate `ios/Runner/AppDelegate.swift`:
61+
62+
```swift
63+
import UIKit
64+
import Flutter
65+
import GoogleMaps
66+
67+
@UIApplicationMain
68+
@objc class AppDelegate: FlutterAppDelegate {
69+
override func application(
70+
_ application: UIApplication,
71+
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
72+
) -> Bool {
73+
GMSServices.provideAPIKey("YOUR KEY HERE")
74+
GeneratedPluginRegistrant.register(with: self)
75+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
76+
}
77+
}
78+
```
6079
Opt-in to the embedded views preview by adding a boolean property to the app's `Info.plist` file
6180
with the key `io.flutter.embedded_views_preview` and the value `YES`.
6281

0 commit comments

Comments
 (0)