Skip to content

Commit 8852240

Browse files
committed
feat: add interactive maps demos to iOS app & upgrade Google Maps SDK to 10.14.0
1 parent c134512 commit 8852240

18 files changed

Lines changed: 1112 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ secrets.properties
2121

2222
# This covers new IDEs, like Antigravity
2323
.vscode/
24+
.antigravitycli/
2425
build-logic/**/bin/

iosApp/.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# CocoaPods
2+
Pods/
3+
Podfile.lock
4+
5+
# Xcode
6+
build/
7+
DerivedData/
8+
*.pbxuser
9+
*.mode1v3
10+
*.mode2v3
11+
*.perspectivev3
12+
xcuserdata/
13+
*.xcworkspace
14+
!default.xcworkspace
15+
*.xcuserstate
16+
17+
# Secrets
18+
iosApp/DeveloperSecrets.swift
19+

iosApp/Podfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
platform :ios, '16.0'
2+
3+
# Ignore warnings from CocoaPods dependencies
4+
inhibit_all_warnings!
5+
6+
target 'iosApp' do
7+
use_frameworks!
8+
9+
# Reference our local KMP module via its podspec path
10+
pod 'maps_compose_multiplatform', :path => '../maps-compose-multiplatform'
11+
end

iosApp/create_project.rb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
require 'xcodeproj'
2+
3+
# Initialize project
4+
project_path = 'iosApp.xcodeproj'
5+
project = Xcodeproj::Project.new(project_path)
6+
7+
# Set deployment target to iOS 16.0 project-wide
8+
project.build_configurations.each do |config|
9+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
10+
end
11+
12+
# Create group for source files (maps to the iosApp directory)
13+
group = project.main_group.new_group('iosApp', 'iosApp')
14+
15+
# Reference source files inside the group
16+
app_delegate_ref = group.new_file('AppDelegate.swift')
17+
sample_list_ref = group.new_file('SampleListViewController.swift')
18+
secrets_ref = group.new_file('DeveloperSecrets.swift')
19+
info_plist_ref = group.new_file('Info.plist')
20+
21+
# Create target
22+
target = project.new_target(:application, 'iosApp', :ios, '16.0')
23+
24+
# Configure target settings
25+
target.build_configurations.each do |config|
26+
config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'com.google.maps.android.compose.iosApp'
27+
config.build_settings['INFOPLIST_FILE'] = 'iosApp/Info.plist'
28+
config.build_settings['SWIFT_VERSION'] = '5.0'
29+
config.build_settings['SDKROOT'] = 'iphoneos'
30+
config.build_settings['TARGETED_DEVICE_FAMILY'] = '1,2'
31+
config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
32+
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
33+
config.build_settings['AD_HOC_CODE_SIGNING_ALLOWED'] = 'YES'
34+
end
35+
36+
# Add a Build Phase Run Script to populate secrets before compilation
37+
populate_secrets_phase = target.new_shell_script_build_phase('Populate Secrets')
38+
populate_secrets_phase.shell_script = <<-SHELL
39+
SECRETS_PATH="${PROJECT_DIR}/../secrets.properties"
40+
OUTPUT_FILE="${SRCROOT}/iosApp/DeveloperSecrets.swift"
41+
42+
API_KEY="YOUR_API_KEY"
43+
44+
if [ -f "$SECRETS_PATH" ]; then
45+
EXTRACTED_KEY=$(grep -E "^MAPS_API_KEY=" "$SECRETS_PATH" | cut -d'=' -f2 | tr -d '"' | tr -d "'")
46+
if [ ! -z "$EXTRACTED_KEY" ]; then
47+
API_KEY="$EXTRACTED_KEY"
48+
fi
49+
fi
50+
51+
cat <<EOF > "$OUTPUT_FILE"
52+
// Generated file. Do not commit or modify.
53+
struct DeveloperSecrets {
54+
static let mapsApiKey = "$API_KEY"
55+
}
56+
EOF
57+
SHELL
58+
59+
# Move the secrets phase to the very beginning of target build phases
60+
target.build_phases.delete(populate_secrets_phase)
61+
target.build_phases.insert(0, populate_secrets_phase)
62+
63+
# Add files to their respective build phases
64+
source_build_phase = target.source_build_phase
65+
source_build_phase.add_file_reference(app_delegate_ref)
66+
source_build_phase.add_file_reference(sample_list_ref)
67+
source_build_phase.add_file_reference(secrets_ref)
68+
69+
project.save
70+
puts "Xcode project created successfully!"
71+

0 commit comments

Comments
 (0)