Skip to content

Commit

Permalink
[FB11356997] Added text
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Kubanek committed Aug 24, 2022
1 parent 34e3383 commit 197b1c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions FB11356997/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Severe regression with animating `UIHostingController` using UIKit animation techniques

Area: SwiftUI Framework
Type: Incorrect/Unexpected Behavior

---

When wrapping a SwiftUI view into a `UIHostingController`, embedding it into a UIKit context, and animating the wrapping `UIView` using UIKit animation techniques (e.g. `UIViewPropertyAnimation`), the hosted SwiftUI view is not animated correctly. This behavior seems to be a regression in the current betas of iOS 16 (observed with β6 and β7) as it works perfectly fine with iOS 15.6.

The faulty behavior is demonstrated in the attached sample project. It uses the UIKit app lifecycle and contains a single `UIViewController`. The view controller embeds a container view which in turn embeds the view of a `UIHostingController`. The container view uses the old-fashioned frame layout, and the hosting controller’s view is embedded using Auto Layout. We applied coloring to help visualize the issue. The background of the hosting controller’s view is set to gray, and the SwiftUI view is colored red.

When applying a spring animation to the height of the container view via `UIViewPropertyAnimator`, the expected outcome is that the red rectangle (SwiftUI view) bounces, and the gray background (`UIHostingController`’s view) is not visible at all. This is exactly what happens on iOS 15.6, as shown in the attached video.

However, on iOS 16 β7, the height of the red rectangle (SwiftUI view) jumps immediately to the final value, and the gray background (`UIHostingController`’s view) performs the animation in the background. This is shown in the second video. Also, see the results side-by-side in the third video.

For such a simple example, there are workarounds we could employ. For instance, we could move the whole animation into the SwiftUI context. However, there are spots in UIKit where this isn’t viable, like using the `UIHostingController` with the `UISheetPresentationController`.

We believe this is a severe regression that should be addressed before releasing the current iteration of SwiftUI as part of iOS 16.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This repository contains a database of feedbacks our team filed with Apple, incl
- [FB9872410](/FB9872410) - Preventing expired TestFlight apps from launching
- [FB10030640](/FB10030640) - Focus in StoreKit Purchase Alert on macOS
- [FB10034253](/FB10034253) - Incorrect baseline alignment of SwiftUI Button on macOS
- [FB11356997](/FB11356997) - Severe regression with animating `UIHostingController` using UIKit animation techniques

## About

Expand Down

0 comments on commit 197b1c9

Please sign in to comment.