Post

Replies

Boosts

Views

Activity

Reply to SwiftUI : tvOS, .contextMenu and .ButtonStyle not working together
I have found a solution to this issue struct MoviesBlankButtonStyle: PrimitiveButtonStyle {   @Environment(\.isFocused) var focused: Bool   @State private var isFocused: Bool = false       func makeBody(configuration: Configuration) -> some View {     configuration.label       .compositingGroup()       .padding(.all, 9)       .focusable(true, onFocusChange: { focused in         if focused {           isFocused = true         } else {           isFocused = false         }       })       .background(RoundedRectangle(cornerRadius: 20).fill(isFocused ? .red : .clear).opacity(0.7 ))       .foregroundColor(isFocused ? .white : .white)       .onTapGesture(perform: configuration.trigger)   } }
Oct ’22