Skip to content

Commit 8dbf46b

Browse files
committed
✨ :: pin.keyBoardLayout not support tvOS
1 parent 6db3cc1 commit 8dbf46b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,8 @@ PinLayout's `UIView.pin.keyBoardLayout` property expose directly the value of UI
13691369

13701370
Bottom of safe area when the keyboard undocked
13711371

1372+
This property can be used from iOS 15 and above.
1373+
13721374
##### Usage example:
13731375
```swift
13741376
view.pin.bottom(pin.keyBoardLayout.top)

Sources/PinLayout.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ public class PinLayout<View: Layoutable> {
8383
}
8484
apply()
8585
}
86+
87+
#if os(iOS)
88+
89+
public var keyBoardLayout: PEdgeInsets {
90+
guard #available(iOS 15.0, *) else { return .zero }
91+
guard let view = view as? UIView else { return .zero }
92+
return view.keyboardLayoutGuide
93+
}
94+
95+
#endif
8696

8797
#if os(iOS) || os(tvOS)
8898
public var safeArea: PEdgeInsets {
@@ -97,12 +107,6 @@ public class PinLayout<View: Layoutable> {
97107
}
98108
}
99109

100-
public var keyBoardLayout: PEdgeInsets {
101-
guard #available(iOS 15.0, *) else { return .zero }
102-
guard let view = view as? UIView else { return .zero }
103-
return view.keyboardLayoutGuide
104-
}
105-
106110
public var readableMargins: PEdgeInsets {
107111
guard #available(iOS 9.0, *) else { return .zero }
108112
guard let view = view as? UIView else { return .zero }

0 commit comments

Comments
 (0)