Skip to content

[various] Update example apps to Swift #9347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 12, 2025

Conversation

stuartmorgan-g
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g commented May 30, 2025

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

Footnotes

  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. 2 3

@stuartmorgan-g
Copy link
Contributor Author

CHANGELOG override: build details of example apps are not relevant to clients.

@stuartmorgan-g stuartmorgan-g added the override: no versioning needed Override the check requiring version bumps for most changes label Jun 2, 2025
@stuartmorgan-g
Copy link
Contributor Author

Version override: The false_secrets removal in extension_google_sign_in_as_googleapis_auth's pubspec.yaml flags for a version change, but that's not something that matters if we publish.

@stuartmorgan-g
Copy link
Contributor Author

@jmagman / @vashworth Do you want me to wait for someone on the iOS team to review this, or should I just land it?

@stuartmorgan-g stuartmorgan-g added the triage-ios Should be looked at in iOS triage label Jun 5, 2025
_exampleApp = nil;
}

- (void)testQuickActionWithFreshStart {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this shouldn't be deleted

@jmagman
Copy link
Member

jmagman commented Jun 11, 2025

How are the PickerSaveImageToPathOperationTests.m tests passing with the images being deleted? Or is it not running any more?

@@ -88,16 +91,9 @@
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! This has been here since the plugin was first checked in.

// the unit tests, so it is better to skip the AppDelegate when running unit tests.
BOOL isTesting = NSClassFromString(@"XCTestCase") != nil;
return UIApplicationMain(argc, argv, nil,
isTesting ? nil : NSStringFromClass([AppDelegate class]));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this logic is for XCTest, and those tests moved to camera_avfoundation when the plugin was fully federated, so this wasn't doing anything. camera_avfoundation still has this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been probably-accidentally unused since #466 recreated the example app. Since this isn't the recommended way to configure Google Sign In on iOS anymore, rather than fix it here I'm just deleting the unused file. If in another 3 years someone needs it set up, they can configure it in Info.plist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These image files are all used in the XCTest tests that moved to image_picker_ios during full federation, so these were cruft.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests were copied to path_provider_foundation during full federation, and were supposed to be deleted from here at the time to make it a move. This duplicate copy doesn't run because there's no native code in path_provider, so repo tooling doesn't attempt to run native unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as path_provider; these test files should have been deleted when they were moved to quick_actions_ios.

@stuartmorgan-g
Copy link
Contributor Author

How are the PickerSaveImageToPathOperationTests.m tests passing with the images being deleted? Or is it not running any more?

The explanatory comments that I wrote when I posted the PR and then accidentally left as drafts for several weeks cover this 🤦🏻

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @stuartmorgan-g!

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 12, 2025
@auto-submit auto-submit bot merged commit b90f8a7 into flutter:main Jun 12, 2025
80 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 13, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jun 13, 2025
flutter/packages@6d3aaf4...c5ab57a

2025-06-13 [email protected] [flutter_svg]
feat: Expose the renderStrategy property in SvgPicture
(flutter/packages#9373)
2025-06-12 [email protected] [go_router] Add routing functions to
GoRouteData (flutter/packages#9277)
2025-06-12 [email protected] [various] Update example apps to
Swift (flutter/packages#9347)
2025-06-12 [email protected] Roll Flutter from
824868f to f79452e (94 revisions) (flutter/packages#9419)
2025-06-12 [email protected]
[android_camera_camerax] Fix incorrect camera mirroring for front
cameras on devices using `ImageReader` Impeller backend
(flutter/packages#9233)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants