[ios]add flutter-ios-uiscene-root-vc-migration#191
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new skill, flutter-ios-uiscene-root-vc-migration, to guide the migration of iOS Flutter plugins to the UIScene lifecycle by using registrar.viewController instead of legacy UIApplication delegate window access. The feedback identifies syntax errors in the Swift examples (using window?? instead of window?) and points out that the code snippets in the YAML configuration are missing essential initializers for both Swift and Objective-C, which would cause compilation failures.
|
|
||
| # This is the configuration file for the skill generator. | ||
| # To generate skills, use the following command (from the `tool` directory): | ||
| # dart run skills generate-skill --config ../resources/flutter_skills.yaml --output ../skills |
There was a problem hiding this comment.
This cmd fails: Could not find an option named "--config".So I updated it.
|
replaced myself with @jwren (not sure who is responsible for the non dart_skills_lint parts of this codebase) |
|
|
||
| Identify usages of direct app-delegate window root view controller access. With the adoption of the `UIScene` lifecycle in iOS, `UIApplication.shared.delegate.window` evaluates to `nil`. | ||
|
|
||
| Locate and replace the following legacy patterns in the codebase: |
There was a problem hiding this comment.
You may want to consider adding something that the patterns may not be exact.
There was a problem hiding this comment.
From my experiment, AI is pretty smart that it was able to detect similar patterns. For example, the flutter_barcode_scanner actually use a very different practice: https://github.com/AmolGangadhare/flutter_barcode_scanner/blob/55a1de73aed51194e58d2a85ddb987629f3adf7f/ios/Classes/SwiftFlutterBarcodeScannerPlugin.swift#L106
|
|
||
| Follow this workflow to migrate a Flutter iOS plugin to support the `UIScene` lifecycle. | ||
|
|
||
| **Task Progress Checklist:** |
There was a problem hiding this comment.
Perhaps add a step to verify it's a plugin. We don't want to adding to non-plugin code.
There was a problem hiding this comment.
good call. Let me double check.
I think you should test it more thoroughly against public plugins and apps. Like we don't want it to activate for apps, only for plugins. Can you verify it doesn't? Also test against plugins that don't need to be migrated, what does it do then? |
| model: models/gemini-3.1-pro-preview | ||
| last_modified: Tue, 21 Jul 2026 21:20:01 GMT | ||
| --- | ||
| # Migrating Flutter iOS Plugins to UIScene |
There was a problem hiding this comment.
This title is automatically added by AI. This is wrong
There was a problem hiding this comment.
it turns out that uiscene is automatically added because of this resource
- https://docs.flutter.dev/release/breaking-changes/uiscenedelegate
I changed it to registrar.viewController's API doc and UIScene references are gone: https://api.flutter.dev/ios-embedder/protocol_flutter_plugin_registrar-p.html#a732bebcd9fcfe9f9f74ea695848d7ea7
This skill migrates the legacy way to get the rootVC from UIApplication, which would be nil after UIScene adoption. The new approach is to get it from the new
registrar.viewControllerAPI.This skill has been battle tested for internal G3 plugins.
Just for sanity check, I have also tried it on a random public plugin flutter_barcode_scanner and confirmed it working too.
List which issues are fixed by this PR. You must list at least one issue.
NA
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.