Pickers are overlapping in ios 15 preventing some of them to be scrolled
try adding
.compositingGroup()
.clipped()
to your Pickers.
iOS15 - SwiftUI WheelPicker scrollable outside frame and clipped area destructing other interfaces
In NumberPicker
try adding compositingGroup
just before clipped(...)
as:
.compositingGroup()
.clipped(antialiased: true)
Clickable area of SwiftUI Picker overlapping
adding this extension is working for me in 15.4
extension UIPickerView {
open override var intrinsicContentSize: CGSize {
return CGSize(width: UIView.noIntrinsicMetric, height: super.intrinsicContentSize.height)}
}
found at https://developer.apple.com/forums/thread/687986?answerId=706782022#706782022
SwiftUI - Placing two pickers side-by-side in HStack does not resize pickers
The overlapping in the middle you can fix by adding a clipped() modifier. As for the width, I see them both exactly the same:
struct ContentView: View {
@State var selection1: Int = 0
@State var selection2: Int = 0
@State var integers: [Int] = [0, 1, 2, 3, 4, 5]
var body: some View {
GeometryReader { geometry in
HStack(spacing: 0) {
Picker(selection: self.$selection1, label: Text("Numbers")) {
ForEach(self.integers) { integer in
Text("\(integer)")
}
}
.frame(maxWidth: geometry.size.width / 2)
.clipped()
.border(Color.red)
Picker(selection: self.$selection2, label: Text("Numbers")) {
ForEach(self.integers) { integer in
Text("\(integer)")
}
}
.frame(maxWidth: geometry.size.width / 2)
.clipped()
.border(Color.blue)
}
}
}
}
Related Topics
How to Handle Hash Collisions for Dictionaries in Swift
How to Handle Two Different Types in an Array in Swift for a Uitableview
Uipickerview Selectrow Doesn't Works
Swiftui Label Text and Image Vertically Misaligned
How to Convert Uint16 to Uint8 in Swift 3
What Are the Advantages Swift Deprecates C-Style for Statement
Callkit - How to Bring the Cxcallcontroller to the Front
How to Change Navigationbar Font in Swift
Swift: How to Convert a String to Uint8 Array
Swift 2: !, ? -" Value of Optional Type "..." Not Unwrapped"
Disable Scrolling in Swiftui List/Form
Safe to Signal Semaphore Before Deinitialization Just in Case
Alamofire Type 'Parameterencoding' Has No Member 'Url' Swift 3
Swift UI MACos Background Transparent Textfield
Many Ways of Defining a Swift Dictionary
Programatic Constraints Not Obeyed
Libsqlite3.Dylib and Libz.Dylib Missing in Xcode 7. How to Use Parse