Skip to content

Commit 27b4487

Browse files
author
Luc Dion
committed
Update safeAreaInsetsDidChangeMode documentation formatting
1 parent 6b12418 commit 27b4487

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,34 +1078,37 @@ The safe area of a view represent the area not covered by navigation bars, tab b
10781078
* **always**: (Default mode) In this mode, PinLayout will call your views `safeAreaInsetsDidChange()` method automatically for iOS releases 7/8/9/10.
10791079

10801080
```swift
1081-
Pin.safeAreaInsetsDidChangeMode = .always
1081+
Pin.safeAreaInsetsDidChangeMode = .always // Default mode
10821082
...
10831083
10841084
class CustomerView: UIView {
10851085
override func safeAreaInsetsDidChange() {
1086-
// This method will be called on iOS 11, but also on iOS 7/8/9/10
1087-
// because "Pin.safeAreaInsetsDidChangeMode" has been set to ".always".
1088-
if #available(iOS 11.0, *) {
1089-
super.safeAreaInsetsDidChange()
1090-
}
1091-
...
1092-
}
1093-
}
1086+
// This method will be called on iOS 11, but also on iOS 7/8/9/10
1087+
// because "Pin.safeAreaInsetsDidChangeMode" has been set to ".always".
1088+
if #available(iOS 11.0, *) {
1089+
super.safeAreaInsetsDidChange()
1090+
}
1091+
...
1092+
}
1093+
}
10941094
```
10951095
10961096
* **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.
10971097

10981098
```swift
1099+
Pin.safeAreaInsetsDidChangeMode = .optIn
1100+
...
1101+
10991102
class CustomerView: UIView, PinSafeAreaInsetsUpdate {
11001103
override func safeAreaInsetsDidChange() {
1101-
// This method will be called on iOS 11, but also on iOS 7/8/9/10
1102-
// because the view implements the protocol PinSafeAreaInsetsUpdate
1103-
if #available(iOS 11.0, *) {
1104-
super.safeAreaInsetsDidChange()
1105-
}
1104+
// This method will be called on iOS 11, but also on iOS 7/8/9/10
1105+
// because the view implements the protocol PinSafeAreaInsetsUpdate
1106+
if #available(iOS 11.0, *) {
1107+
super.safeAreaInsetsDidChange()
1108+
}
11061109
...
1107-
}
1108-
}
1110+
}
1111+
}
11091112
```
11101113
* **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.
11111114

0 commit comments

Comments
 (0)