I am trying to get a basic app working where a SwiftUI View is used as the inputAccessoryView of a ViewController.
This worked and then stopped working.
The issue now is the InputAccessoryView disappears when the textfield in it is tapped and a warnings are logged in the console. The InputAccessoryView returns upon tapping the screen again.
Any help is appreciated, thanks
Warnings:
UITextEffectsWindow should not become key. Please file a bug to Keyboard | iOS with this call stack: (
0 UIKitCore 0x00000001b205a040 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 17498176
1 UIKitCore 0x00000001b1fdbf00 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 16981760
2 UIKitCore 0x00000001b135c050 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3874896
3 UIKitCore 0x00000001b130139c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3503004
4 UIKitCore 0x00000001b1352d70 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3837296
5 UIKitCore 0x00000001b136033c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3892028
6 UIKitCore 0x00000001b107e500 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 869632
7 UIKitCore 0x00000001b14c5e00 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 5357056
8 UIKitCore 0x00000001b201b49c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 17241244
9 UIKitCore 0x00000001b201bfe8 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 17244136
10 UIKitCore 0x00000001b11e6cb4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 2346164
11 UIKitCore 0x00000001b19ae5c8 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 10503624
12 UIKitCore 0x00000001b105e990 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 739728
13 UIKitCore 0x00000001b13c0384 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 4285316
14 UIKitCore 0x00000001b11411dc 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 1667548
15 UIKitCore 0x00000001b1029464 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 521316
16 UIKitCore 0x00000001b10cfaf0 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 1202928
17 UIKitCore 0x00000001b1a3f578 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 11097464
18 UIKitCore 0x00000001b109581c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 964636
19 UIKitCore 0x00000001b109a168 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 983400
20 UIKitCore 0x00000001b10993dc 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 979932
21 UIKitCore 0x00000001b10976c4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 972484
22 UIKitCore 0x00000001b10df1d4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 1266132
23 UIKitCore 0x00000001b1e87d50 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 15588688
24 UIKitCore 0x00000001b168460c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 7185932
25 UIKitCore 0x00000001b1d756c4 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 14464708
26 UIKitCore 0x00000001b1d74c1c 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 14461980
27 CoreFoundation 0x00000001aef18e50 4D10D650-0AE2-3264-82CF-C654DC239382 + 855632
28 CoreFoundation 0x00000001aef23f84 4D10D650-0AE2-3264-82CF-C654DC239382 + 900996
29 CoreFoundation 0x00000001aeeb1d74 4D10D650-0AE2-3264-82CF-C654DC239382 + 433524
30 CoreFoundation 0x00000001aeec4104 4D10D650-0AE2-3264-82CF-C654DC239382 + 508164
31 CoreFoundation 0x00000001aeec8da0 CFRunLoopRunSpecific + 600
32 GraphicsServices 0x00000001f0c2c224 GSEventRunModal + 164
33 UIKitCore 0x00000001b1339154 6A70FE3C-D189-3F5E-8F40-7591547B46CA + 3731796
34 UIKitCore 0x00000001b1338db8 UIApplicationMain + 340
35 SwiftUI 0x00000001b2b9b1a8 5A2584FB-9A71-3724-A788-554A9BC99FC3 + 1663400
36 SwiftUI 0x00000001b2b09f2c 5A2584FB-9A71-3724-A788-554A9BC99FC3 + 1068844
37 SwiftUI 0x00000001b2af3c1c 5A2584FB-9A71-3724-A788-554A9BC99FC3 + 977948
38 APP_NAME 0x00000001026f40dc $s5APP_NAME0A3AppV5$mainyyFZ + 40
39 APP_NAME 0x00000001026f418c main + 12
40 dyld 0x00000001d1a7a4f8 81F3004E-360C-372E-BBF8-7E4304D23776 + 87288
)
Failed to retrieve snapshot.
-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID
Skipping performing textoperation; partner: <UIKeyboardImpl: 0x104853200; frame = (0 0; 0 0); opaque = NO; layer = <CALayer: 0x281060780>>, targetSessioID: DE44ADE6-3DC8-416A-9275-630B2D4F1BC8, currentSessionID:
Code:
class ChatViewController: UIViewController {
var chatViewController: UIViewController = UIHostingController(rootView: ChatView())
var chatBarViewController: UIViewController = UIHostingController(rootView: ChatBarView())
override func viewDidLoad() {
self.addChild(chatViewController)
view.addSubview(chatViewController.view)
chatViewController.view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
chatViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
chatViewController.view.topAnchor.constraint(equalTo: view.topAnchor),
chatViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
chatViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
chatBarViewController.view.translatesAutoresizingMaskIntoConstraints = false
chatBarViewController.view.backgroundColor = .clear
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.becomeFirstResponder()
}
override var inputAccessoryView: UIView {
return chatBarViewController.view
}
override var canBecomeFirstResponder: Bool {
return true
}
override var canResignFirstResponder: Bool {
return true
}
}
struct ChatViewControllerRepresentable: UIViewControllerRepresentable {
...
}