@FocusedValue values from .focusedSceneValue are nil when using keyboard shortcuts or their HUD (iOS & iPadOS 15 Beta)

Originator:joaocolaco
Number:rdar://FB9163579 Date Originated:12/06/2021
Status:Open Resolved:
Product:SwiftUI Product Version:iOS 15 Beta
Classification: Reproducible:
 
As described in the docs .focusedSceneValue modifies this view by injecting a value that you provide for use by other views whose state depends on the focused scene.
One of the aims is to make available to the Scene commands some way to change the Scene view states. However it doesn't work. These value are always nil, as if the view that is modified by  .focusedSceneValue isn't in a Scene with focus.
The same happens if another view of the Scene tries to retrieve the value with @FocusedValue. In the code sample that I've attached a Button will execute the closure that is the value being shared. But if the Button is pressed with a keyboard shortcut @FocusedValue will be nil.

Comments

I think this https://openradar.appspot.com/radar?id=5041527457841152 might be related. Is the problem still happening in on iOS?

By jonathan.hume at Nov. 13, 2021, 12:53 p.m. (reply...)

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!