-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS API breaking change] Make splashScreenView of FlutterViewController nullable #34743
[iOS API breaking change] Make splashScreenView of FlutterViewController nullable #34743
Conversation
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.
LGTM
I'm not familiar with the breaking change process in the engine repro.
@zanderso can you (or someone in the engine team) review for the breaking change process?
What will this change break? |
see #34496 (comment) |
@zanderso Specifically it would be a compilation error if the calling code is in Swift and gets the splash screen and stores in a nonnull
They would need to update their code to instead store in a @UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
var splashScreen = UIView()
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
var flutterEngine = FlutterEngine(name: "my flutter engine")
let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
splashScreen = flutterViewController.splashScreenView // compilation error: Value of optional type 'UIView?' must be unwrapped to a value of type 'UIView' More likely the add-to-app developer is just setting the view. Storing it with @UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
var flutterEngine = FlutterEngine(name: "my flutter engine")
let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
let splashScreen = flutterViewController.splashScreenView // compiles successfully |
Thanks @jmagman. It sounds like this would just need a small migration guide. |
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.
LGTM, I'll make sure flutter/website#7385 deprecation notice gets merged.
…wController nullable (flutter/engine#34743)
Based on the talk of https://github.com/flutter/engine/pull/34496/files#r923640588, we should make splashScreenView nullable, then Swift users can remove splashScreenView if they set
nil
.But it lead to an API-breaking change for Swift users, if Swift users use the getter of splashScreenView, the return type changed from UIView to UIView? .
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.