From e793e6c48bfd13ec9770254e454e8f28d9dd8e07 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 15 Nov 2025 20:20:48 +0100 Subject: [PATCH] Fix tvOS build compatibility for Menu with primaryAction Add availability check for tvOS 17.0+ when using Menu with primaryAction parameter. Falls back to simple Button for tvOS 15.0-16.x to maintain backward compatibility with the deployment target. --- Shared/Subscriptions/FeedView.swift | 42 ++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/Shared/Subscriptions/FeedView.swift b/Shared/Subscriptions/FeedView.swift index da3a8423..e1279772 100644 --- a/Shared/Subscriptions/FeedView.swift +++ b/Shared/Subscriptions/FeedView.swift @@ -223,21 +223,37 @@ struct FeedView: View { var header: some View { HStack(spacing: 16) { #if os(tvOS) - Menu { - accountsPicker - } label: { - Label("Channels", systemImage: "filemenu.and.selection") - .labelStyle(.iconOnly) - .imageScale(.small) - .font(.caption) - } primaryAction: { - withAnimation { - self.feedChannelsViewVisible = true - self.focusedChannel = selectedChannel?.id ?? "all" + if #available(tvOS 17.0, *) { + Menu { + accountsPicker + } label: { + Label("Channels", systemImage: "filemenu.and.selection") + .labelStyle(.iconOnly) + .imageScale(.small) + .font(.caption) + } primaryAction: { + withAnimation { + self.feedChannelsViewVisible = true + self.focusedChannel = selectedChannel?.id ?? "all" + } } + .opacity(feedChannelsViewVisible ? 0 : 1) + .frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil) + } else { + Button { + withAnimation { + self.feedChannelsViewVisible = true + self.focusedChannel = selectedChannel?.id ?? "all" + } + } label: { + Label("Channels", systemImage: "filemenu.and.selection") + .labelStyle(.iconOnly) + .imageScale(.small) + .font(.caption) + } + .opacity(feedChannelsViewVisible ? 0 : 1) + .frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil) } - .opacity(feedChannelsViewVisible ? 0 : 1) - .frame(minWidth: feedChannelsViewVisible ? 0 : nil, maxWidth: feedChannelsViewVisible ? 0 : nil) channelHeaderView if selectedChannel == nil { Spacer()