|
Hello everyone. I just start learning SwiftUI. Today's challenge I make a Temperature Conversion. I think it work not so good.so there have two question for me. First is when I use @FocusState with NavigationView, the Xcode's preview dont work but I can build succeful.I dont know just I have this problem? my Xcode Version is Version 13.2.1 (13C100).macOS is 12.1 Second is when I used FocusState but sometime the keyboard did not come out. I can just see "Done" button at right side on the screen without keyboard. Here is my code, can someone help me? thx
|
|
Dealing with your second question first. It is likely that you are toggling the Edit - To be clear when you have the hardware keyboard connected to your simulator, the decimal pad will not appear on the simulator, so you will only see the focused As for the preview, I should not worry about it, as long as you can build and run the app on the simulator or device, that should be fine. |
|
@osmc94. These weird bugs are hard for new developers. Did you make the error, if so WHERE? I pasted your entire code into a new XCode (13.2.1) project, compiled it, and ran it on my iPhone 11 with iOS 15.2.1. It runs fine! No issues with keyboard. Navigation works nicely. Calculations are accurate. In his videos, @twostraws has often mentioned that the Preview panel often does not work properly. Or takes its time. Or fails to draw. There are too many to note here. It may not be worth the effort to try and find a reason. Instead, keep up with the latest updates on your OS and XCode versions. If the preview doesn't compile, try the usual: Clean Build. Test on real iPhone. Probably not the best answer for you. Keep coding! |
|
|
|
Thanks a lot guys.I decide to reinstall my mac and Xcode .then I will see if it will solved. |
SPONSORED Spend less time managing in-app purchase infrastructure so you can focus on building your app. RevenueCat gives everything you need to easily implement, manage, and analyze in-app purchases and subscriptions without managing servers or writing backend code.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.