-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[iOS] Migrate @UIApplicationMain attribute to @main #146707
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
[iOS] Migrate @UIApplicationMain attribute to @main #146707
Conversation
5cc9612 to
ad18797
Compare
| import UIKit | ||
|
|
||
| @UIApplicationMain | ||
| @main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a Flutter application. I updated this by hand.
| } | ||
|
|
||
| @UIApplicationMain | ||
| @main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains significant edits from the starter app template. The migration is flexible enough to be able to update this correctly.
jmagman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits, LGTM! Thank you for doing this!
packages/flutter_tools/lib/src/ios/migrations/uiapplicationmain_deprecation_migration.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/ios/migrations/uiapplicationmain_deprecation_migration.dart
Outdated
Show resolved
Hide resolved
@loic-sharma Did you happen to check if NSApplicationMain (the macOS version of this) was also deprecated? I'm not sure if we want to mark the issue as fixed since it refers to both the iOS and macOS version. If we want to handle them separately, can you file a separate issue to address the macOS one? |
|
How do I trigger this migration for existing projects? Do I run a migration command? Or do I simply do |
The migrations run when the app compiles, so every |
|
@vashworth Good point, I'll update the macOS template in a follow-up pull request using the same issue. I'll keep the issue open until then! EDIT: macOS pull request is here: #146848 |
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@NSApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md This change is split into two commits: 1. a508d3e - This updates the macOS app template and adds a migration to replace `@NSApplicationMain` uses with `@main`. 2. f434827 - I ran `flutter run -d macos` on each Flutter macOS app in this repository to verify the app migrates and launches successfully. Follow-up to #146707 Fixes #143044
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@UIApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md This change is split into two commits: 1. flutter@ad18797 - This updates the iOS app template and adds a migration to replace `@UIApplicationMain` uses with `@main`. 2. flutter@8ecbb2f - I ran `flutter run` on each Flutter iOS app in this repository to verify the app migrates and launches successfully. Part of flutter#143044
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@NSApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md This change is split into two commits: 1. flutter@a508d3e - This updates the macOS app template and adds a migration to replace `@NSApplicationMain` uses with `@main`. 2. flutter@f434827 - I ran `flutter run -d macos` on each Flutter macOS app in this repository to verify the app migrates and launches successfully. Follow-up to flutter#146707 Fixes flutter#143044
This migrates Flutter to use the
@mainattribute introduced in Swift 5.3. The@UIApplicationMainattribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.mdThis change is split into two commits:
@UIApplicationMainuses with@main.flutter runon each Flutter iOS app in this repository to verify the app migrates and launches successfully.Part of #143044
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.