88
99import UIKit
1010
11- internal class Keyboard {
11+ @ MainActor internal class Keyboard {
1212 static let shared = Keyboard ( )
1313 var currentHeight : CGFloat = 0
1414}
1515
1616extension UIView {
1717 private enum Identifiers {
18- static var usingSafeArea = " KeyboardLayoutGuideUsingSafeArea "
19- static var notUsingSafeArea = " KeyboardLayoutGuide "
18+ static let usingSafeArea = " KeyboardLayoutGuideUsingSafeArea "
19+ static let notUsingSafeArea = " KeyboardLayoutGuide "
2020 }
2121
2222 /// A layout guide representing the inset for the keyboard.
@@ -44,7 +44,7 @@ extension UIView {
4444 }
4545}
4646
47- open class KeyboardLayoutGuide : UILayoutGuide {
47+ @ MainActor open class KeyboardLayoutGuide : UILayoutGuide {
4848 public var usesSafeArea = true {
4949 didSet {
5050 updateBottomAnchor ( )
@@ -145,7 +145,8 @@ extension UILayoutGuide {
145145}
146146
147147extension Notification {
148- var keyboardHeight : CGFloat ? {
148+
149+ @MainActor var keyboardHeight : CGFloat ? {
149150 guard let keyboardFrame = userInfo ? [ UIResponder . keyboardFrameEndUserInfoKey] as? NSValue else {
150151 return nil
151152 }
@@ -167,7 +168,7 @@ extension Notification {
167168
168169// Credits to John Gibb for this nice helper :)
169170// https://stackoverflow.com/questions/1536923/determine-if-uiview-is-visible-to-the-user
170- func isVisible( view: UIView ) -> Bool {
171+ @ MainActor func isVisible( view: UIView ) -> Bool {
171172 func isVisible( view: UIView , inView: UIView ? ) -> Bool {
172173 guard let inView = inView else { return true }
173174 let viewFrame = inView. convert ( view. bounds, from: view)
0 commit comments