|
SwiftUI XCode The following is a snippet of code I am working on. I am having trobule with. my preview after adding Focus State which I later use to swap an info button for a DONE button to dismiss the keyboard in a texteditor view. Everything works fine in the preview and my phone runs the following code fine but I can not preview the layout in xcode. I get the following error. MessageSendFailure: Message send failure for update ================================== | MessageError: Connection interrupted I have attempted to delete derived data and have reinstalled simulator devices to no avail. If I comment out all the FocusState stuff it previews fine.
|
|
I'm also getting this debugger message: 2021-12-19 21:30:12.432819-0800 InfoReport[11369:3184898] [Snapshotting] Snapshotting a view (0x13400bc00, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES. |
|
I'm running into this exact same thing, it just started with xcode 13.2.1 or ios 15.2 I'm not sure. I'm seeing bugs in NavigationViews now also, so something with those new versions are just broken. |
|
I switched back to xcode 13.1 and the focus state seems to be working again in swiftUI previews |
|
I was having this issue also, and it looks like someone found an easy workaround. Mine worked after wrapping the ContentView() in a ZStack within the preview provider. Here: https://stackoverflow.com/questions/70430440/why-focusstate-crashing-swiftui-preview |
|
The workaround I found here is to wrap the preview in a ZStack, like so:
I know it sounds silly, but there you go: worked for me, anyway. |
SPONSORED You know StoreKit, but you don’t want to do StoreKit. RevenueCat makes it easy to deploy, manage, and analyze in-app subscriptions on iOS and Android so you can focus on building your app.
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.