tvOS 15 regression: Custom tab bar fonts are not loaded correctly at launch

Originator:defagos
Number:rdar://FB9650323 Date Originated:Sep 24, 2021
Status:Closed Resolved:Fixed
Product:UIKit Product Version:tvOS 15
Classification:Incorrect behavior Reproducible:Always
 
Description of the problem:
---------------------------

When customizing the tvOS tab bar using `UITabBarAppearance` font settings are not loaded correctly after application launch on tvOS 15. When the tab bar is refreshed (e.g. by exiting it or by moving the focus on top of each tab) these incorrect font settings are fixed, and stay correctly applied while the application stays alive.

This issue is a regression introduced with tvOS 15. Tab bar font customization was working fine in tvOS 13 and tvOS 14 with no visible glitches. Note that this new issue affects applications built with the tvOS 15 SDK and running on tvOS 15, as well as applications built with the tvOS 14 SDK and run on tvOS 15.

The present issue only affects font customization in the tab bar. Other properties customized with `UITabBarAppearance` (e.g. colors) are not affected. The issue is also specific to tvOS 15 and similar customization for iOS apps works correctly on iOS 15.


How to reproduce the problem:
-------------------------------

I attached a simple sample project to this issue. This project was created using the tvOS application template and only includes a tab bar and simple content views made of a button each (so that you can move the focus around). The tab bar has been customized in several ways with `UITabBarAppearance`:

- Fonts (very large so that the issue can be clearly seen).
- Colors (foreground and background).

This basic implementation only customizes the `normal` item appearance but the issue affects other appearances as well.

Proceed as follows to reproduce the issue:

1. Run the sample project on tvOS 15 with Xcode 13, either on device or in the simulator.
2. After the app has started look at the tab bar. You can clearly see that the focused tab has correct fonts (as it was refreshed) but that other tabs have the default font. Colors are correct, though.
3. Now either move the focus outside the tab bar or on each tab. You can see the fonts being fixed as tabs are refreshed.

If you now run the same project on tvOS 14 (device or simulator, built with Xcode 13 or Xcode 12) you can observe that fonts are correctly loaded right after the application is launched.


Expected results
-----------------

Custom tab bar fonts set with `UITabBarAppearance` on tvOS 15 are correctly applied. See attached `expected_result.jpg` screenshot.


Actual results:
--------------

Custom tab bar fonts set with `UITabBarAppearance` on tvOS 15 are not applied after the application was launched, but only as tabs are refreshed (e.g. due to focus changes). See attached `actual_result.jpg` screenshot.

Comments

Fixed

Works fine in tvOS 15.4 beta 1

Sample code

Available on Github: https://github.com/defagos/radars/tree/master/tvos-tab-bar-appearance-issue


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!