Skip to content

Commit 703f262

Browse files
committed
Renamed property pin.keyboardMargins -> pin.keyBoardArea. This new name better represent what UIKit's UIView.keyboardLayoutGuide is.
1 parent 17995f9 commit 703f262

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
# Change Log
99

10+
## [1.10.2](https://github.com/layoutBox/PinLayout/releases/tag/1.10.2)
11+
Released on 2022-02-01
12+
13+
#### Renamed property `pin.keyboardMargins` -> `pin.keyBoardArea`
14+
15+
This new name better represent what `UIKit`'s `UIView.keyboardLayoutGuide` is.
16+
17+
Added by [Luc Dion](https://github.com/lucdion) in Pull Request [#238](https://github.com/layoutBox/PinLayout/pull/238)
18+
1019
## [1.10.1](https://github.com/layoutBox/PinLayout/releases/tag/1.10.1)
1120
Released on 2022-02-01
1221

PinLayout.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |spec|
1010
spec.name = "PinLayout"
11-
spec.version = "1.10.1"
11+
spec.version = "1.10.2"
1212
spec.summary = "Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast."
1313
spec.description = "Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable. [iOS/macOS/tvOS/CALayer]"
1414
spec.homepage = "https://github.com/layoutBox/PinLayout"

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Extremely Fast views layouting without auto layout. No magic, pure code, full co
3838
* Xcode 13 / 12 / 11 / 10
3939

4040
### Recent changes/features
41-
* :star: Add [`pin.keyboardMargins`](#safeAreaInsets) property [iOS 15+]
41+
* :star: Add [`pin.keyBoardArea`](#safeAreaInsets) property [iOS 15+]
4242
* :star: New chainable Objective-C syntax. See [PinLayout using Objective-C](#objective_c_interface)
4343
* :star: Automatic Sizing, use PinLayout to compute view size. See [Automatic sizing](#automatic_sizing)
4444
* :star: Add methods to position a view between two other views. See [Layout between other views](#layout_between).
@@ -1230,7 +1230,7 @@ PinLayout expose them using these properties:
12301230
1. **`UIView.pin.safeArea`**: Expose UIKit `UIView.safeAreaInsets` / `UIView.safeAreaLayoutGuide`.
12311231
2. **`UIView.pin.readableMargins`**: Expose UIKit `UIView.readableContentGuide`.
12321232
3. **`UIView.pin.layoutMargins`**: Expose UIKit `UIView.layoutMargins` / `UIView.layoutMarginsGuide`.
1233-
4. **`UIView.pin.keyboardMargins`**: Expose UIKit `UIView.keyboardLayoutGuide`. [iOS 15+]
1233+
4. **`UIView.pin.keyBoardArea`**: Expose UIKit `UIView.keyboardLayoutGuide`. [iOS 15+]
12341234

12351235
The following image display the 3 areas on an iPad in landscape mode. (safeArea, readableMargins, layoutMargins)
12361236

@@ -1362,15 +1362,15 @@ PinLayout's `UIView.pin.layoutMargins` property expose directly the value of UIK
13621362

13631363
<br/>
13641364

1365-
### 4. pin.keyboardMargins:
1365+
### 4. pin.keyBoardArea:
13661366

13671367
##### Property:
1368-
* **`pin.keyboardMargins: UIEdgeInset` [iOS 15+]**
1369-
PinLayout's `UIView.pin.keyboardMargins` property expose directly the value of UIKit [`UIView.keyboardLayoutGuide`](https://developer.apple.com/documentation/uikit/keyboards_and_input/adjusting_your_layout_with_keyboard_layout_guide). This is really useful when layout adjustment due to the keyboard is required. [iOS 15+]
1368+
* **`pin.keyBoardArea: CGRect` [iOS 15+]**
1369+
The property expose the `UIKit` value [`UIView.keyboardLayoutGuide`](https://developer.apple.com/documentation/uikit/keyboards_and_input/adjusting_your_layout_with_keyboard_layout_guide). It represents the area (`CGRect`) of the keyboard that is covering the view. Useful to adjust the layout when the keyboard is visible. [iOS 15+]
13701370

13711371
##### Usage example:
13721372
```swift
1373-
container.pin.bottom(view.pin.keyboardMargins.top)
1373+
container.pin.bottom(view.pin.keyBoardArea.top)
13741374
```
13751375

13761376

Sources/PinLayout.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,11 @@ public class PinLayout<View: Layoutable> {
116116
#endif
117117

118118
#if os(iOS)
119-
public var keyboardMargins: PEdgeInsets {
119+
public var keyBoardArea: CGRect {
120120
guard #available(iOS 15.0, *) else { return .zero }
121121
guard let view = view as? UIView else { return .zero }
122122

123-
let layoutFrame = view.keyboardLayoutGuide.layoutFrame
124-
guard !layoutFrame.isEmpty else { return .zero }
125-
126-
return UIEdgeInsets(top: layoutFrame.origin.y,
127-
left: layoutFrame.origin.x,
128-
bottom: view.frame.height - layoutFrame.origin.y - layoutFrame.height,
129-
right: view.frame.width - layoutFrame.origin.x - layoutFrame.width)
123+
return view.keyboardLayoutGuide.layoutFrame
130124
}
131125
#endif
132126

0 commit comments

Comments
 (0)