Skip to content

Commit bddb59a

Browse files
committed
Phase 3: Update example app to support SPM
- Backed up Podfile for SPM testing - Example app can now use either CocoaPods or SPM
1 parent 551283c commit bddb59a

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '12.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
end
36+
37+
post_install do |installer|
38+
installer.pods_project.targets.each do |target|
39+
flutter_additional_ios_build_settings(target)
40+
41+
target.build_configurations.each do |config|
42+
# You can remove unused permissions here
43+
# for more information: https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
44+
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
45+
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
46+
'$(inherited)',
47+
48+
## dart: PermissionGroup.calendar
49+
'PERMISSION_EVENTS=1',
50+
51+
## dart: PermissionGroup.calendarFullAccess
52+
'PERMISSION_EVENTS_FULL_ACCESS=1',
53+
54+
## dart: PermissionGroup.reminders
55+
'PERMISSION_REMINDERS=1',
56+
57+
## dart: PermissionGroup.contacts
58+
'PERMISSION_CONTACTS=1',
59+
60+
## dart: PermissionGroup.camera
61+
'PERMISSION_CAMERA=1',
62+
63+
## dart: PermissionGroup.microphone
64+
'PERMISSION_MICROPHONE=1',
65+
66+
## dart: PermissionGroup.speech
67+
'PERMISSION_SPEECH_RECOGNIZER=1',
68+
69+
## dart: PermissionGroup.photos
70+
'PERMISSION_PHOTOS=1',
71+
72+
## The 'PERMISSION_LOCATION' macro enables the `locationWhenInUse` and `locationAlways` permission. If
73+
## the application only requires `locationWhenInUse`, only specify the `PERMISSION_LOCATION_WHENINUSE`
74+
## macro.
75+
##
76+
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
77+
'PERMISSION_LOCATION=1',
78+
'PERMISSION_LOCATION_WHENINUSE=0',
79+
80+
## dart: PermissionGroup.notification
81+
'PERMISSION_NOTIFICATIONS=1',
82+
83+
## dart: PermissionGroup.mediaLibrary
84+
'PERMISSION_MEDIA_LIBRARY=1',
85+
86+
## dart: PermissionGroup.sensors
87+
'PERMISSION_SENSORS=1',
88+
89+
## dart: PermissionGroup.bluetooth
90+
'PERMISSION_BLUETOOTH=1',
91+
92+
## dart: PermissionGroup.appTrackingTransparency
93+
'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
94+
95+
## dart: PermissionGroup.criticalAlerts
96+
'PERMISSION_CRITICAL_ALERTS=1',
97+
98+
## dart: PermissionGroup.assistant
99+
'PERMISSION_ASSISTANT=1',
100+
]
101+
102+
end
103+
end
104+
end

0 commit comments

Comments
 (0)