added argument to voice over on the search bar automatically

- also removed the geomtry reader in favour of a `readWidth` function
This commit is contained in:
Mauro Romito
2025-05-08 16:26:33 +02:00
committed by Mauro
parent 489f784640
commit 36242bc271
3 changed files with 52 additions and 28 deletions
@@ -31,4 +31,15 @@ extension View {
height.wrappedValue = newValue
}
}
/// Reads the width of the view and stores it in the `width` binding.
/// - Parameters:
/// - width: a `CGFloat` binding
func readWidth(_ width: Binding<CGFloat>) -> some View {
onGeometryChange(for: CGFloat.self) { geometry in
geometry.size.width
} action: { newValue in
width.wrappedValue = newValue
}
}
}