# iOS FlutterViewController splashScreenView made nullable

> FlutterViewController splashScreenView changed from nonnull to nullable.




:::important
These breaking change docs are accurate, as of the release
under which they are published. Over time, the
workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up
to date as of each release.

这些破坏性改动文档的准确性仅限于其发布时对应的版本。
随着时间的推移，文档中描述的方案可能会逐渐失效。
通常情况下，我们不会在每次发布新版本时都对这些文档进行同步更新。

The [breaking change index file](/release/breaking-changes)
lists the docs created for each release.

[破坏性改动列表](/release/breaking-changes) 
列出了每个版本的文档。

:::


## Summary

The `FlutterViewController` property `splashScreenView` has
been changed from `nonnull` to `nullable`.

Old declaration of `splashScreenView`:

```objc
@property(strong, nonatomic) UIView* splashScreenView;
```

New declaration of `splashScreenView`:

```objc
@property(strong, nonatomic, nullable) UIView* splashScreenView;
```

## Context

Prior to this change, on iOS the `splashScreenView` property returned `nil`
when no splash screen view was set, and
setting the property to `nil` removed the splash screen view.
However, the `splashScreenView` API was incorrectly marked `nonnull`.
This property is most often used when transitioning to
Flutter views in iOS add-to-app scenarios.

## Description of change

While it was possible in Objective-C to work around the
incorrect `nonnull` annotation by setting `splashScreenView` to
a `nil` `UIView`, in Swift this caused a compilation error:

```plaintext
error build: Value of optional type 'UIView?' must be unwrapped to a value of type 'UIView'
```

[PR #34743][] updates the property attribute to `nullable`.
It can return `nil` and can be set to `nil` to
remove the view in both Objective-C and Swift.

## Migration guide

If `splashScreenView` is stored in a `UIView` variable in Swift,
update to an optional type `UIView?`.

Code before migration:

```swift
  var splashScreenView = UIView()
  var flutterEngine = FlutterEngine(name: "my flutter engine")
  let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
  splashScreenView = flutterViewController.splashScreenView // compilation error: Value of optional type 'UIView?' must be unwrapped to a value of type 'UIView'
```

Code after migration:

```swift
  var splashScreenView : UIView? = UIView()
  var flutterEngine = FlutterEngine(name: "my flutter engine")
  let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
  let splashScreenView = flutterViewController.splashScreenView // compiles successfully
  if let splashScreenView = splashScreenView {
  }
```

## Timeline

In stable release: 3.7

## References

Relevant PR:

* [Make splashScreenView of FlutterViewController nullable][]

[Make splashScreenView of FlutterViewController nullable]: https://github.com/flutter/engine/pull/34743
[PR #34743]: https://github.com/flutter/engine/pull/34743

