Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc Dion committed Apr 23, 2018
1 parent 2b5de4e commit af36127
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@

# Change Log



## [1.7.1](https://github.com/layoutBox/FlexLayout/releases/tag/1.7.1)
Released on 2018-04-23

### Fine tune UIView.pin.safeArea support for iOS 8 and "New Relic" framework
Changes:

* On iOS 8, PinLayout compatibility support of UIView.safeAreaInsetsDidChange was causing issues with the device's virtual keyboard. PinLayout still support UIView.pin.safeArea on this iOS release, but UIView.safeAreaInsetsDidChange won't be called on iOS 8

* Fix issue with "New Relic" framework: Add a Pin.initPinLayout() that can be called to initialize PinLayout before the "New Relic" framework is initialized. "New Relic" is conflicting with other popular frameworks including Mixpanel, ReactiveCocoa, Aspect, ..., and PinLayout. To fix the issue, Pin.initPinLayout() must be called BEFORE initializing "New Relic" with NewRelic.start(withApplicationToken:"APP_TOKEN"). See here for more information regarding this issue #130

Added by [Luc Dion](https://github.com/lucdion) in Pull Request [#134](https://github.com/mirego/PinLayout/pull/134)



## [1.7.0](https://github.com/layoutBox/FlexLayout/releases/tag/1.7.0)
Released on 2018-04-20

Expand Down
2 changes: 1 addition & 1 deletion PinLayout.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |spec|
spec.name = "PinLayout"
spec.version = "1.7.0"
spec.version = "1.7.1"
spec.summary = "Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. [iOS/macOS/tvOS]"
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]"
spec.homepage = "https://mirego.github.io/PinLayout/"
Expand Down
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ NOTE: In that in that particular situation, the same results could have been ach
<a name="safeAreaInsets"></a>
## UIKit safeAreaInsets support

PinLayout can handle easily iOS 11 `UIView.safeAreaInsets`, but it goes further by supporting safeAreaInsets for previous iOS releases (including iOS 7/8/9/10) by adding a property `UIView.pin.safeArea`. PinLayout also extend the support of `UIView.safeAreaInsetsDidChange()` callback on iOS 7/8/9/10.
PinLayout can handle easily iOS 11 `UIView.safeAreaInsets`, but it goes further by supporting safeAreaInsets for previous iOS releases (including iOS 7/8/9/10) by adding a property `UIView.pin.safeArea`. PinLayout also extends the support of `UIView.safeAreaInsetsDidChange()` callback on iOS 7/8/9/10.

##### Property:

Expand Down Expand Up @@ -1067,26 +1067,15 @@ The safe area of a view represent the area not covered by navigation bars, tab b

##### UIView.safeAreaInsetsDidChange():

* iOS 11 has also introduced the method [`UIView.safeAreaInsetsDidChange()`](https://developer.apple.com/documentation/uikit/uiview/2891104-safeareainsetsdidchange) which is called when the safe area of the view changes. This method is called only when your app runs on a iOS 11 device. **PinLayout's extend that and support this method also on older iOS releases including iOS 7/8/9/10**.
* iOS 11 has also introduced the method [`UIView.safeAreaInsetsDidChange()`](https://developer.apple.com/documentation/uikit/uiview/2891104-safeareainsetsdidchange) which is called when the safe area of the view changes. This method is called only when your app runs on a iOS 11 device. **PinLayout's extend that and support this method also on older iOS releases including iOS 9/10**.

* Note that if you handle the layout from `UIView.layoutSubviews()` or `UIViewController.viewDidLayoutSubviews()`, **you probably won't need to implement `safeAreaInsetsDidChange()`**. By default layout are invalidated and these methods are called when the safeAreaInsets changes.

* **Controlling PinLayout UIView.safeAreaInsetsDidChange() calls:**
You can control how PinLayout calls `UIView.safeAreaInsetsDidChange()` for iOS 7/8/9/10 (by default iOS 11 always calls this method).
You can control how PinLayout calls `UIView.safeAreaInsetsDidChange()` for iOS 7/8/9/10 (by default iOS 11 natively calls this method).

**The property `Pin.safeAreaInsetsDidChangeMode` supports two modes**:
1. **optIn**: (Default mode) In this mode PinLayout will call your view's `safeAreaInsetsDidChange()` method only if the view implements the `PinSafeAreaInsetsUpdate` protocol. This ensure that PinLayout doesn't interfere with any source code that expect that `safeAreaInsetsDidChange()` is called only on iOS 11.

```swift
class CustomerView: UIView, PinSafeAreaInsetsUpdate {
override func safeAreaInsetsDidChange() {
// This method will be called on iOS 11, but also on iOS 7/8/9/10
// because the view implements the protocol PinSafeAreaInsetsUpdate
}
}
```

2. **always**: In this mode, PinLayout will call your views `safeAreaInsetsDidChange()` method automatically for iOS releases 7/8/9/10.
**The property `Pin.safeAreaInsetsDidChangeMode` supports 3 modes**:
* **always**: (Default mode) In this mode, PinLayout will call your views `safeAreaInsetsDidChange()` method automatically for iOS releases 7/8/9/10.

```swift
Pin.safeAreaInsetsDidChangeMode = .always
Expand All @@ -1099,6 +1088,18 @@ The safe area of a view represent the area not covered by navigation bars, tab b
}
}
```
* **optIn**: (Default mode) In this mode PinLayout will call your view's `safeAreaInsetsDidChange()` method only if the view implements the `PinSafeAreaInsetsUpdate` protocol. This ensure that PinLayout doesn't interfere with any source code that expect that `safeAreaInsetsDidChange()` is called only on iOS 11.

```swift
class CustomerView: UIView, PinSafeAreaInsetsUpdate {
override func safeAreaInsetsDidChange() {
// This method will be called on iOS 11, but also on iOS 7/8/9/10
// because the view implements the protocol PinSafeAreaInsetsUpdate
}
}
```
* **disable**: In this mode PinLayout won't call `UIView.safeAreaInsetsDidChange` on iOS 8/9/10. Note that this is the default mode on iOS 8.
<br>

Expand Down

0 comments on commit af36127

Please sign in to comment.