Fix compiling for visionOS

This commit is contained in:
Shadowfacts 2024-06-16 17:49:25 -07:00
parent 45a90fb4a2
commit 7c3a00a40d
2 changed files with 9 additions and 0 deletions

View File

@ -64,9 +64,15 @@ struct AddReactionView: View {
}
.searchable(text: $query, placement: .navigationBarDrawer(displayMode: .always))
.searchPresentationToolbarBehaviorIfAvailable()
#if os(visionOS)
.onChange(of: query) {
updateFilteredEmojis()
}
#else
.onChange(of: query) { _ in
updateFilteredEmojis()
}
#endif
.navigationTitle("Add Reaction")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
@ -166,6 +172,7 @@ private struct AddReactionButton<Label: View>: View {
private extension View {
@available(iOS, obsoleted: 16.0)
@available(visionOS 1.0, *)
@ViewBuilder
func mediumPresentationDetentIfAvailable() -> some View {
if #available(iOS 16.0, *) {
@ -176,6 +183,7 @@ private extension View {
}
@available(iOS, obsoleted: 17.1)
@available(visionOS 1.0, *)
@ViewBuilder
func searchPresentationToolbarBehaviorIfAvailable() -> some View {
if #available(iOS 17.1, *) {

View File

@ -421,6 +421,7 @@ private class UbiquitousKeyValueStoreObserver: ObservableObject {
private extension View {
@available(iOS, obsoleted: 17.0)
@available(visionOS 1.0, *)
@ViewBuilder
func manageSubscriptionsSheetIfAvailable(isPresented: Binding<Bool>, subscriptionGroupID: String) -> some View {
if #available(iOS 17.0, *) {