MCPcopy Create free account
hub / github.com/react-native-maps/react-native-maps / withMapsIOS

Function withMapsIOS

plugin/src/ios.ts:18–45  ·  view source on GitHub ↗
(config, props)

Source from the content-addressed store, hash-verified

16 /\bsuper\.application\(\w+?, didFinishLaunchingWithOptions: \w+?\)/g;
17
18export const withMapsIOS: ConfigPlugin<ConfigPluginProps> = (config, props) => {
19 // Set in Info.plist
20 if (props?.iosGoogleMapsApiKey) {
21 config = withInfoPlist(config, async conf => {
22 if (!conf.ios) {
23 conf.ios = {};
24 }
25 if (!conf.ios.infoPlist) {
26 conf.ios.infoPlist = {};
27 }
28
29 conf.ios.infoPlist.GMSApiKey = props?.iosGoogleMapsApiKey;
30 return conf;
31 });
32 }
33
34 // Technically adds react-native-maps (Apple maps) and google maps.
35 config = withMapsCocoaPods(config, {
36 useGoogleMaps: !!props?.iosGoogleMapsApiKey,
37 });
38
39 // Adds/Removes AppDelegate setup for Google Maps API on iOS
40 config = withGoogleMapsAppDelegate(config, {
41 apiKey: props?.iosGoogleMapsApiKey || null,
42 });
43
44 return config;
45};
46
47export function addGoogleMapsAppDelegateImport(src: string): MergeResults {
48 const newSrc = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif'];

Callers 1

withMapsFunction · 0.90

Calls 2

withMapsCocoaPodsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…