Skip to content

(Draft) Update iOS snippets to reflect UISceneDelegate adoption#13305

Open
johnpryan wants to merge 2 commits intoflutter:mainfrom
johnpryan:migrate-docs-to-uiscene
Open

(Draft) Update iOS snippets to reflect UISceneDelegate adoption#13305
johnpryan wants to merge 2 commits intoflutter:mainfrom
johnpryan:migrate-docs-to-uiscene

Conversation

@johnpryan
Copy link
Copy Markdown
Contributor

Description of what this PR is changing or adding, and why:

This updates iOS code snippets to conform to the UIScene lifecycle migration.

  • Update platform-channels.md to use didInitializeImplicitFlutterEngine.
  • Update platform-views.md to use didInitializeImplicitFlutterEngine and add protocol conformance.
  • Update add-flutter-screen.md to include configurationForConnecting in AppDelegate.

Issues fixed by this PR (if any):

Fixes #13087
Fixes #13086
Fixes #13274

PRs or commits this PR depends on (if any):

None.

Presubmit checklist

  • If you are unwilling, or unable, to sign the CLA, even for a tiny, one-word PR, please file an issue instead of a PR.
  • If this PR is not meant to land until a future stable release, mark it as draft with an explanation.
  • This PR follows the Google Developer Documentation Style Guidelines—for example, it doesn't use i.e. or e.g., and it avoids I and we (first-person pronouns).
  • [ x This PR uses semantic line breaks
    of 80 characters or fewer.

@flutter-website-bot
Copy link
Copy Markdown
Collaborator

flutter-website-bot commented Apr 24, 2026

Visit the preview URL for this PR (updated for commit 7bdc9a8):

https://flutter-docs-prod--pr13305-migrate-docs-to-uiscene-iiubeubj.web.app

Copy link
Copy Markdown
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

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

This looks great, @johnpryan! I know it's a draft, but I will approve. Let me know if it needs further attention.

@johnpryan johnpryan requested a review from vashworth April 28, 2026 16:02
@johnpryan johnpryan marked this pull request as ready for review April 28, 2026 16:36
@johnpryan johnpryan requested a review from a team as a code owner April 28, 2026 16:36
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates iOS documentation to reflect UIScene support as the default and transitions platform integration examples to use didInitializeImplicitFlutterEngine:. Feedback includes correcting a version typo, updating documentation links to UISceneDelegate methods, adopting idiomatic Swift naming conventions, and fixing a missing header import in an Objective-C snippet.

Comment thread sites/docs/src/content/add-to-app/ios/add-flutter-screen.md
As of Flutter 3.41, `UIScene` support is the default for iOS apps.
When using `FlutterAppDelegate`, you should also ensure that your app
uses `FlutterSceneDelegate` (or a subclass) to receive scene lifecycle
events, such as [`openURL`][] and [`continueUserActivity`][].
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The links for openURL and continueUserActivity point to UIApplicationDelegate methods. Since this section specifically discusses UIScene lifecycle events, it would be more accurate to link to the corresponding UISceneDelegate methods: scene(_:openURLContexts:) and scene(_:continue:).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/content/add-to-app/ios/add-flutter-screen.md Outdated
@@ -163,7 +163,7 @@ Finally, register the platform view.
This can be done in an app or a plugin.

For app registration,
modify the App's `AppDelegate.swift`:
implement the `didInitializeImplicitFlutterEngine:` method in the App's `AppDelegate.swift`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In the Swift section, it is more idiomatic to use Swift method naming conventions instead of the Objective-C selector style.

Suggested change
implement the `didInitializeImplicitFlutterEngine:` method in the App's `AppDelegate.swift`:
implement the `didInitializeImplicitFlutterEngine(_:)` method in the App's `AppDelegate.swift`:

@@ -608,7 +608,7 @@ Add support for Swift in the standard template setup that uses Objective-C:
1. Open the file `AppDelegate.swift` located under **Runner > Runner**
in the Project navigator.

Override the `application:didFinishLaunchingWithOptions:` function and create
Implement the `didInitializeImplicitFlutterEngine:` method and create
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In the Swift section, it is more idiomatic to use Swift method naming conventions instead of the Objective-C selector style.

Suggested change
Implement the `didInitializeImplicitFlutterEngine:` method and create
Implement the `didInitializeImplicitFlutterEngine(_:)` method and create

Comment on lines 712 to +716
#import <Flutter/Flutter.h>
#import "GeneratedPluginRegistrant.h"

@interface AppDelegate () <FlutterImplicitEngineDelegate>
@end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Objective-C snippet for AppDelegate.m is missing the import for AppDelegate.h. This will cause a compilation error as the compiler won't recognize the AppDelegate class when declaring the category.

Suggested change
#import <Flutter/Flutter.h>
#import "GeneratedPluginRegistrant.h"
@interface AppDelegate () <FlutterImplicitEngineDelegate>
@end
#import "AppDelegate.h"
#import <Flutter/Flutter.h>
#import "GeneratedPluginRegistrant.h"
@interface AppDelegate () <FlutterImplicitEngineDelegate>
@end

)
configuration.delegateClass = FlutterSceneDelegate.self
return configuration
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm not sure where this is from, but I don't think this is what we want to recommend.

Add-to-App users need to update their SceneDelegate (or create one and add to Info.plist if they don't already have one) to subclass the FlutterSceneDelegate and if they can't, then to use the FlutterSceneLifeCycleProvider

See UIScene docs:
https://docs.flutter.dev/release/breaking-changes/uiscenedelegate#migration-guide-for-adding-flutter-to-existing-app-add-to-app
https://docs.flutter.dev/release/breaking-changes/uiscenedelegate#migrate-info-plist
https://docs.flutter.dev/release/breaking-changes/uiscenedelegate#migrate-info-plist

Comment thread src/content/add-to-app/ios/add-flutter-screen.md
As of Flutter 3.41, `UIScene` support is the default for iOS apps.
When using `FlutterAppDelegate`, you should also ensure that your app
uses `FlutterSceneDelegate` (or a subclass) to receive scene lifecycle
events, such as [`openURL`][] and [`continueUserActivity`][].
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

johnpryan added 2 commits May 5, 2026 13:45
- Update platform-channels.md to use didInitializeImplicitFlutterEngine.
- Update platform-views.md to use didInitializeImplicitFlutterEngine and add protocol conformance.
- Update add-flutter-screen.md to include configurationForConnecting in AppDelegate.

Fixes flutter#13087
Fixes flutter#13086
Fixes flutter#13274
@johnpryan johnpryan force-pushed the migrate-docs-to-uiscene branch from f33ea89 to 7bdc9a8 Compare May 5, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants