|
Hi, I have posted this question in a few places and it's not really been solved, so I thought I would ask here too to get your opinions. I have just started learning SwiftUI and have created a basic View as follows:
When I tap the search field and the keyboard appears, the List jumps down the screen briefly, before animating. This happens consistently when running the app on my device (iPhone 11 Pro - iOS 16.3). You can see the issue in the video here: https://reddit.com/link/10tql80/video/8mjpo7c0g8ga1/player I have also tried running the app on the an iPhone 14 Simulator (iOS 16.2), where the problem always happens the first time you focus the search bar, then very infrequently after that. I am using Xcode 14.2, but have also tried the same code with Xcode 14.0. I would be grateful if someone could let me know if I'm doing something wrong here, or if SwiftUI is just incredibly buggy? Thank you for any help in advance. |
|
@twoStraws offers a large number of useful videos along with great "How To" articles. Did you watch his Instruments series? See -> How to find buggy animations One of Instrument's options is to document Give it a go! This is a forum for sharing education. Please run some Instrument profiles and come back and tell us what you learned! |
|
Here's a great article from Apple's Developer site on reporting bugs. See -> Great Bug Reports |
|
I understand needing Instruments to diagnose issues with my own animations etc, but needing to debug the built-in animations for such a basic example would suggest to me that I'm doing something fundamentally wrong which I imagine would be obvious to someone with more experience than me, or SwiftUI is just very buggy. If we take one of the examples written by @twoStraws here: https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-search-bar-to-filter-your-data I have modifiered it slightly to show the border of each View for debug purposes:
You can see the problem again from the iOS Simulator in the following GIF. The animation issue happens the first time you focus the Search field, but not the second time. On my physical iOS device the problem occurs every time though, which does suggest the performance of the device may be relevant. It's hard to believe that the basic built-in components would be this buggy, so it leads me to believe that there could be some settings I'm missing to improve the app's performance. I have tried switching to the Release profile in Xcode but this doesn't improve things. Alternatively this is just the state of SwiftUI and I need to accept that it's far from perfect, or use UIKit? |
|
Hi @GlassFisherman2279, This won't help you much, but from my experience, a SwiftUI app can come with certain glitches which either depend on the version of iOS you are using or the version of Xcode they got build with. You can test the first case by downloading a simulator for another version of iOS. As you already tried your app with 16.3 on your device and 16.2 in the simulator, you may want to try one of the 15.x branches (though they may be limited in their capabilities). I can only talk for SwiftUI as that's my learning path. I have (almost) no experience with UIKit so I can't compare these two. |
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.