SFSafariViewController's preferred colors are invalidated after rotation

There are two issues about SFSafariViewController.

After rotate from landscape to portrait,

  1. The topAnchor is destroyed.
  2. The specified bar tint color and control tint color are invalidated.(Returns to system color)

Regarding the second issue, I’ve found a temporary workaround. Override the viewWillTransition(to:with:) and keep it empty. Don't call super.viewWillTransition(to:with:).

Since UIKit is not open source, I don’t know the exact cause, but I found something that could be the key to the issue. So, I reported it to Apple Feedback Assistant. You can check the details and the sample project in the GitHub repository below.

https://github.com/ueunli/SafariViewer

SFSafariViewController's preferred colors are invalidated after rotation
 
 
Q