Skip to content

Commit b90f8a7

Browse files
[various] Update example apps to Swift (#9347)
Converts the Objective-C iOS example apps for all non-iOS-plugin-implementation packages to Swift. The process for this was (all using current `stable`, 3.32): - Deleted example/ios. - Ran `flutter create --platforms=ios .`. - Reverted changes in `ios/Runner/Assets.xcassets/AppIcon.appiconset` (this doesn't really matter either way, I just decided not to thrash a bunch of icons, since there's no real reason to and it would have added a ton more files). - Reverted changes outside of `ios/`, except for `.gitignore` which we may as well have a current version of. - Added license blocks to template-created code files. - Removed the `RunnerTest` target, its source file, and the `Podfile` adjustment to `RunnerTest`. - Reverted bundle identifier changes in most cases, since it was often auto-detecting the old `io.flutter.*` org the examples were first created with. - Re-added any important bits to `Info.plist`. - Ran a build both with and without SwiftPM enabled, to ensure that all the Cocoapods and SwiftPM boilerplate is added to the projects to cut down on random diffs when people build later. One-off changes: - Added back `Configuration.storkekit` in in_app_purchase. - Migrated the Google Maps API key code in AppDelegate.m to AppDelegate.swift I did not convert the implementation packages in this PR because those will need to be handled more carefully, due to the presence of RunnerTest (and sometimes RunnerUITest) targets that need to be preserved. Part of flutter/flutter#148586 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent f7b32d9 commit b90f8a7

File tree

254 files changed

+3511
-2659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+3511
-2659
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.build/
9+
.buildlog/
10+
.history
11+
.svn/
12+
.swiftpm/
13+
migrate_working_dir/
14+
15+
# IntelliJ related
16+
*.iml
17+
*.ipr
18+
*.iws
19+
.idea/
20+
21+
# The .vscode folder contains launch configuration and tasks you configure in
22+
# VS Code which you may wish to be included in version control, so this line
23+
# is commented out by default.
24+
#.vscode/
25+
26+
# Flutter/Dart/Pub related
27+
**/doc/api/
28+
**/ios/Flutter/.last_build_id
29+
.dart_tool/
30+
.flutter-plugins
31+
.flutter-plugins-dependencies
32+
.pub-cache/
33+
.pub/
34+
/build/
35+
36+
# Symbolication related
37+
app.*.symbols
38+
39+
# Obfuscation related
40+
app.*.map.json
41+
42+
# Android Studio will place build artifacts here
43+
/android/app/debug
44+
/android/app/profile
45+
/android/app/release
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
**/dgph
2+
*.mode1v3
3+
*.mode2v3
4+
*.moved-aside
5+
*.pbxuser
6+
*.perspectivev3
7+
**/*sync/
8+
.sconsign.dblite
9+
.tags*
10+
**/.vagrant/
11+
**/DerivedData/
12+
Icon?
13+
**/Pods/
14+
**/.symlinks/
15+
profile
16+
xcuserdata
17+
**/.generated/
18+
Flutter/App.framework
19+
Flutter/Flutter.framework
20+
Flutter/Flutter.podspec
21+
Flutter/Generated.xcconfig
22+
Flutter/ephemeral/
23+
Flutter/app.flx
24+
Flutter/app.zip
25+
Flutter/flutter_assets/
26+
Flutter/flutter_export_environment.sh
27+
ServiceDefinitions.json
28+
Runner/GeneratedPluginRegistrant.*
29+
30+
# Exceptions to above rules.
31+
!default.mode1v3
32+
!default.mode2v3
33+
!default.pbxuser
34+
!default.perspectivev3

packages/camera/camera/example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
23-
<key>UIRequiredDeviceCapabilities</key>
24-
<array>
25-
<string>arm64</string>
26-
</array>
2723
<key>MinimumOSVersion</key>
2824
<string>12.0</string>
2925
</dict>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2-
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
32
#include "Generated.xcconfig"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2-
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
32
#include "Generated.xcconfig"

packages/camera/camera/example/ios/Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
2828
flutter_ios_podfile_setup
2929

3030
target 'Runner' do
31+
use_frameworks!
32+
3133
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3234
end
3335

packages/camera/camera/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 126 additions & 66 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>PreviewsEnabled</key>
6+
<false/>
7+
</dict>
8+
</plist>

packages/camera/camera/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
buildConfiguration = "Debug"
4545
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4646
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
4748
shouldUseLaunchSchemeArgsEnv = "YES">
4849
<MacroExpansion>
4950
<BuildableReference
@@ -56,10 +57,11 @@
5657
</MacroExpansion>
5758
<Testables>
5859
<TestableReference
59-
skipped = "NO">
60+
skipped = "NO"
61+
parallelizable = "YES">
6062
<BuildableReference
6163
BuildableIdentifier = "primary"
62-
BlueprintIdentifier = "03BB76672665316900CE5A93"
64+
BlueprintIdentifier = "331C8080294A63A400263BE5"
6365
BuildableName = "RunnerTests.xctest"
6466
BlueprintName = "RunnerTests"
6567
ReferencedContainer = "container:Runner.xcodeproj">
@@ -71,6 +73,7 @@
7173
buildConfiguration = "Debug"
7274
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7375
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
76+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
7477
launchStyle = "0"
7578
useCustomWorkingDirectory = "NO"
7679
ignoresPersistentStateOnLaunch = "NO"
@@ -88,16 +91,9 @@
8891
ReferencedContainer = "container:Runner.xcodeproj">
8992
</BuildableReference>
9093
</BuildableProductRunnable>
91-
<AdditionalOptions>
92-
<AdditionalOption
93-
key = "NSZombieEnabled"
94-
value = "YES"
95-
isEnabled = "YES">
96-
</AdditionalOption>
97-
</AdditionalOptions>
9894
</LaunchAction>
9995
<ProfileAction
100-
buildConfiguration = "Release"
96+
buildConfiguration = "Profile"
10197
shouldUseLaunchSchemeArgsEnv = "YES"
10298
savedToolIdentifier = ""
10399
useCustomWorkingDirectory = "NO"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>PreviewsEnabled</key>
6+
<false/>
7+
</dict>
8+
</plist>

packages/camera/camera/example/ios/Runner/AppDelegate.m

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import Flutter
6+
import UIKit
7+
8+
@main
9+
@objc class AppDelegate: FlutterAppDelegate {
10+
override func application(
11+
_ application: UIApplication,
12+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
13+
) -> Bool {
14+
GeneratedPluginRegistrant.register(with: self)
15+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
16+
}
17+
}

packages/camera/camera/example/ios/Runner/Info.plist

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleDevelopmentRegion</key>
6-
<string>en</string>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>Camera Example</string>
79
<key>CFBundleExecutable</key>
810
<string>$(EXECUTABLE_NAME)</string>
911
<key>CFBundleIdentifier</key>
@@ -15,13 +17,11 @@
1517
<key>CFBundlePackageType</key>
1618
<string>APPL</string>
1719
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
20+
<string>$(FLUTTER_BUILD_NAME)</string>
1921
<key>CFBundleSignature</key>
2022
<string>????</string>
2123
<key>CFBundleVersion</key>
22-
<string>1</string>
23-
<key>LSApplicationCategoryType</key>
24-
<string></string>
24+
<string>$(FLUTTER_BUILD_NUMBER)</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSCameraUsageDescription</key>
@@ -32,10 +32,6 @@
3232
<string>LaunchScreen</string>
3333
<key>UIMainStoryboardFile</key>
3434
<string>Main</string>
35-
<key>UIRequiredDeviceCapabilities</key>
36-
<array>
37-
<string>arm64</string>
38-
</array>
3935
<key>UISupportedInterfaceOrientations</key>
4036
<array>
4137
<string>UIInterfaceOrientationPortrait</string>

packages/google_maps_flutter/google_maps_flutter/example/ios/Runner/AppDelegate.h renamed to packages/camera/camera/example/ios/Runner/Runner-Bridging-Header.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import <Flutter/Flutter.h>
6-
#import <UIKit/UIKit.h>
7-
8-
@interface AppDelegate : FlutterAppDelegate
9-
@end
5+
#import "GeneratedPluginRegistrant.h"

packages/camera/camera/example/ios/Runner/main.m

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/extension_google_sign_in_as_googleapis_auth/example/ios/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**/dgph
12
*.mode1v3
23
*.mode2v3
34
*.moved-aside

packages/extension_google_sign_in_as_googleapis_auth/example/ios/Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
2828
flutter_ios_podfile_setup
2929

3030
target 'Runner' do
31+
use_frameworks!
32+
3133
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3234
end
3335

0 commit comments

Comments
 (0)