Skip to content

Commit c15d59c

Browse files
committed
Updates to Swift 6
1 parent b14abc2 commit c15d59c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:6.0
22
import PackageDescription
33

44
let package = Package(
55
name: "KeyboardLayoutGuide",
6-
platforms: [.iOS(.v9)],
6+
platforms: [.iOS(.v12)],
77
products: [.library(name: "KeyboardLayoutGuide", targets: ["KeyboardLayoutGuide"])],
88
targets: [.target(name: "KeyboardLayoutGuide")]
99
)

Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
import UIKit
1010

11-
internal class Keyboard {
11+
@MainActor internal class Keyboard {
1212
static let shared = Keyboard()
1313
var currentHeight: CGFloat = 0
1414
}
1515

1616
extension 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

147147
extension 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

Comments
 (0)