This is my first post, I think by sheer bumbling I found a way to get multiple pickers in a single view without the touch targets overlapping in XCode 13.2.1, IOS 15.2. I was unable to get it to work with various iterations of .clipped(), .compositingGroup() as discussed in the thread above, but did get it to work with embedding the Picker inside a horizontal ScrollView. In my example below, I also embedded the ScrollView in a Group so I could center the wheel of the ScrollView and keep its vertical dimensions tight, so the parent Starting Census View has a ListView, each child with 3 horizontally adjacent Picker views, all able to be turned independently and without landing on adjacent pickers' target areas. Holding my breath that this is not broken in a future OS 15 update.
struct DigitDialView: View {
@Binding var currentValue: Int
var minValue = 0
var maxValue = 20
var body: some View {
Group {
ScrollView {
Picker("census",selection: $currentValue){
ForEach(minValue..<maxValue){value in
Text("\(value)").tag(value)
}
}
.pickerStyle(.wheel)
.frame(width: 40)
}
.frame(height: 215)
}
.frame(height: 45)
.clipped()
}
}
}
}
Post
Replies
Boosts
Views
Activity
More bumbling, but just to add to my prior answer above, when I tried this in a new project, I was again inadvertently touching the touch targets of the wrong census. The fix was to embed the picker in a List within a NavigationView, with a navigationViewStyle of .stack. I wish I could recall where I found the tip to use the stack style, that was definitely a tip from StackOverflow but I can't find where I pulled it from, hat tip to whoever figured that out and apologies for being unable to specifically find whom to credit.
@EnvironmentObject var displayedAssignment: DisplayedAssignment
var body: some View {
NavigationView{
List{
DigitDialView(currentValue: $displayedAssignment.dailyAssignment.count1, maxValue: 99)
DigitDialView(currentValue: $displayedAssignment.dailyAssignment.count2, maxValue: 99)
}
}.navigationViewStyle(.stack)
I'm curious as to what you found, I have the exact same question. Also sort of fascinating, I proposed the question to ChatGPT, and it provided links that sounded promising, but all of which were 404 not found links:
___"Test-Driven Development with CloudKit and SwiftUI" by Craig Clayton on the Ray Wenderlich website: This tutorial covers how to use Test Driven Development with CloudKit and SwiftUI. It includes examples of setting up a test environment, creating mock data, and writing unit tests for CloudKit code. Link: https://www.raywenderlich.com/9700429-test-driven-development-with-cloudkit-and-swiftui
"Testing with CloudKit" by John Sundell on the Swift by Sundell website: This article covers how to test CloudKit code using XCTest. It includes examples of mocking CloudKit dependencies, writing unit tests for CloudKit operations, and using test doubles. Link: https://www.swiftbysundell.com/articles/testing-with-cloudkit/
"Unit Testing CloudKit Operations in Swift" by Kushagra Verma on the Medium website: This article covers how to use Test Driven Development to write unit tests for CloudKit operations such as fetching records and handling errors. It includes examples of setting up a test environment, creating mock data, and writing unit tests using XCTest. Link: https://kushagra.dev/posts/unit-testing-cloudkit-operations-in-swift/
"CloudKit and Test Driven Development" by David Kittell on the Thoughtbot website: This article covers how to use Test Driven Development with CloudKit. It includes examples of writing unit tests for CloudKit operations using XCTest, and using mock objects to isolate CloudKit code from other parts of your app. Link: https://thoughtbot.com/blog/cloudkit-and-test-driven-development___
Each of these sounds tantalizingly like exactly what I'm looking for, but I have been unsuccessful finding the information anywhere online, even given the author's names and looking on the Swift by Sundell website, etc. If you found anything that provides guidance or wisdom, please let me know! Many thanks.
Bob
I'm having the identical problem. Did you figure yours out?
Thanks for looking into this, Quinn. I am having the same issue. I have also submitted a request through feedback assistant regarding inoperative breakpoints in ios16, which along with repeated crashes in the simulator in iOS17 (AegirPoster, ManageAppDistributionD, FindMyLocateD) have slowed my development to a crawl.