8
8
9
9
import UIKit
10
10
11
- internal class Keyboard {
11
+ @ MainActor internal class Keyboard {
12
12
static let shared = Keyboard ( )
13
13
var currentHeight : CGFloat = 0
14
14
}
15
15
16
16
extension UIView {
17
17
private enum Identifiers {
18
- static var usingSafeArea = " KeyboardLayoutGuideUsingSafeArea "
19
- static var notUsingSafeArea = " KeyboardLayoutGuide "
18
+ static let usingSafeArea = " KeyboardLayoutGuideUsingSafeArea "
19
+ static let notUsingSafeArea = " KeyboardLayoutGuide "
20
20
}
21
21
22
22
/// A layout guide representing the inset for the keyboard.
@@ -44,7 +44,7 @@ extension UIView {
44
44
}
45
45
}
46
46
47
- open class KeyboardLayoutGuide : UILayoutGuide {
47
+ @ MainActor open class KeyboardLayoutGuide : UILayoutGuide {
48
48
public var usesSafeArea = true {
49
49
didSet {
50
50
updateBottomAnchor ( )
@@ -145,7 +145,8 @@ extension UILayoutGuide {
145
145
}
146
146
147
147
extension Notification {
148
- var keyboardHeight : CGFloat ? {
148
+
149
+ @MainActor var keyboardHeight : CGFloat ? {
149
150
guard let keyboardFrame = userInfo ? [ UIResponder . keyboardFrameEndUserInfoKey] as? NSValue else {
150
151
return nil
151
152
}
@@ -167,7 +168,7 @@ extension Notification {
167
168
168
169
// Credits to John Gibb for this nice helper :)
169
170
// 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 {
171
172
func isVisible( view: UIView , inView: UIView ? ) -> Bool {
172
173
guard let inView = inView else { return true }
173
174
let viewFrame = inView. convert ( view. bounds, from: view)
0 commit comments