Hello!
Im using Xcode 13 beta 2 , building on Apple TV 4K, tvOS 15.0 (physical device)
I was implementing new functionality into the tvOS app I'm working on and encountered some difficulties trying to use new .transportBarCustomMenuItems property.
I'm creating a UIMenu, debug shows that Menu has children and overlay shows my created items, but when I'm trying to click on it, nothing happens, nor menus or actions don't call handler func I'm providing and those pretty controls im adding just have no use. Help me understand if I'm doing something wrong.
He's pseudo code im using
private func createLocalizationMenuControl() -> UIMenuElement? {
let image = UIImage(systemName: "gear")
let menuChildren = localizations.compactMap { [weak self] localization in
self?.createLocaliztionAction(from: localization)
}
return menu = UIMenu(title: "Localizations",
image: image,
options: [.singleSelection],
children: menuChildren)
}
private func createLocaliztionAction(from localization: Localiztion) -> UIAction {
return UIAction(title: localization.name,
state: localization.isAvailable ? .on : .off,
handler: { [weak self] _ in self?.didSelectLocalization($0) })
}
Note: if I'm settings options: [.singleSelection, .displayInline] for UIMenu like it was shown in wwdc21-10191 session - its not displayed at all.
I am starting to believe its beta related. Any ideas why this could be happening or how to make it work?
Maybe anyone from Apple engineer team could help me understand how do parameters of the UIMenu reflect on its behaviour. Unfortunately there's not that much docs on this functionality yet. I would be very grateful if someone could explain this one to me.