I am utilizing SpriteView to show a SpriteKit scene in SwiftUI. I’ve a textfield within the EditObject SwiftUI struct, and when the keyboard seems / disappears, the keyboard animation is laggy / jittery.
I believe that is because of the SpriteView. The SpriteView (and all the things else) is avoiding the keyboard. I don’t know why I am unable to forestall this. I’ve tried:
.ignoresSafeArea()
.ignoresSafeArea([.container, .keyboard])
.ignoresSafeArea(.keyboard)
.ignoresSafeArea(.container)
on all parts right here, e.g:
struct ContentView: View {
@StateObject var viewModel = GameViewModel()
var physique: some View {
ZStack {
SpriteView(scene: viewModel.scene)
.ignoresSafeArea([.container, .keyboard])
if viewModel.showMenu {
EditObject(viewModel: viewModel)
.ignoresSafeArea([.container, .keyboard])
}
}
.ignoresSafeArea([.container, .keyboard])
}
}
Ideally I simply need the SpriteView to not keep away from the keyboard (to remain mounted in place at al occasions). However I am unable to even get the opposite elements to not keep away from, both.
Alternatively is there a solution to keep away from the keyboard animation lag with SpriteView?