Skip to content

Commit

Permalink
fix(ReceivedEmptyView): Hide FAB before iOS 18.2 (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinperignon authored Jan 21, 2025
2 parents d40d657 + 9565da3 commit a846677
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion SwissTransferFeatures/ReceivedView/ReceivedEmptyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ReceivedEmptyView: View {
)
.padding(value: .medium)
.scrollableEmptyState()
.floatingActionButton(selection: $selection, style: fabStyle)
.emptyStateFloatingButton(selection: $selection, style: fabStyle)
.onChange(of: selection) { newSelectedItems in
mainViewState.newTransferContainer = NewTransferContainer(importedItems: newSelectedItems)
}
Expand All @@ -55,3 +55,14 @@ struct ReceivedEmptyView: View {
}
}
}

extension View {
@ViewBuilder func emptyStateFloatingButton(selection: Binding<[ImportedItem]>,
style: FloatingActionButtonStyle) -> some View {
if #available(iOS 18.2, *) {
self.floatingActionButton(selection: selection, style: style)
} else {
self
}
}
}

0 comments on commit a846677

Please sign in to comment.