Skip to content

Commit

Permalink
Updates to Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha committed Sep 20, 2024
1 parent b14abc2 commit c15d59c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// swift-tools-version:5.1
// swift-tools-version:6.0
import PackageDescription

let package = Package(
name: "KeyboardLayoutGuide",
platforms: [.iOS(.v9)],
platforms: [.iOS(.v12)],
products: [.library(name: "KeyboardLayoutGuide", targets: ["KeyboardLayoutGuide"])],
targets: [.target(name: "KeyboardLayoutGuide")]
)
13 changes: 7 additions & 6 deletions Sources/KeyboardLayoutGuide/KeyboardLayoutGuide.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

import UIKit

internal class Keyboard {
@MainActor internal class Keyboard {
static let shared = Keyboard()
var currentHeight: CGFloat = 0
}

extension UIView {
private enum Identifiers {
static var usingSafeArea = "KeyboardLayoutGuideUsingSafeArea"
static var notUsingSafeArea = "KeyboardLayoutGuide"
static let usingSafeArea = "KeyboardLayoutGuideUsingSafeArea"
static let notUsingSafeArea = "KeyboardLayoutGuide"
}

/// A layout guide representing the inset for the keyboard.
Expand Down Expand Up @@ -44,7 +44,7 @@ extension UIView {
}
}

open class KeyboardLayoutGuide: UILayoutGuide {
@MainActor open class KeyboardLayoutGuide: UILayoutGuide {
public var usesSafeArea = true {
didSet {
updateBottomAnchor()
Expand Down Expand Up @@ -145,7 +145,8 @@ extension UILayoutGuide {
}

extension Notification {
var keyboardHeight: CGFloat? {

@MainActor var keyboardHeight: CGFloat? {
guard let keyboardFrame = userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return nil
}
Expand All @@ -167,7 +168,7 @@ extension Notification {

// Credits to John Gibb for this nice helper :)
// https://stackoverflow.com/questions/1536923/determine-if-uiview-is-visible-to-the-user
func isVisible(view: UIView) -> Bool {
@MainActor func isVisible(view: UIView) -> Bool {
func isVisible(view: UIView, inView: UIView?) -> Bool {
guard let inView = inView else { return true }
let viewFrame = inView.convert(view.bounds, from: view)
Expand Down

0 comments on commit c15d59c

Please sign in to comment.