Playing around with Xcode 12 Beta1
After creating Ludo I started working on another game and this time using new Xcode 12 features. Developing using Beta is always hard as you cannot be sure if any bug you encounter is a bug in the Beta frameworks or you are missing something. I encountered two problem and these almost wasted all of my time today 😔
- LazyVGrid
Try this gist on Xcode beta 1 and scrolling vertically will freeze the App with 99% CPU usage. Change the VGridItem to Text from Button and still better. For now I switched to custom Grid but hopefully before the public release will be able to use the LazyVGrid.
- Taps going to buttons in ScrollView
Check out this gist, so I changed to custom Grid and encountered this problem. The button at top is not getting touch events after I scroll vertically. The touches in infact are going to the buttons inside ScrollView which I realized very late as the buttons are not even visible on screen. I cannot say for sure if it is a bug but thankfully was able to solve by changing the zIndex of top button to 1.
Button {
self.tapMeCount += 1
} label: {
Text("Tap Me")
.padding(10)
}
.zIndex(1)