Skip to content

Commit 7fee167

Browse files
author
Luc Dion
committed
update
1 parent 384c5c1 commit 7fee167

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

README.md

Lines changed: 15 additions & 13 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
* Swift 3.2+ / Swift 4.1 / Objective-C
3939

4040
### Recent changes/features
41-
* :star: Add [`pin.readableMargins` and `pin.layoutMargins`](#layout_margins) properties.
41+
* :star: Add [`pin.readableMargins` and `pin.layoutMargins`](#safeAreaInsets) properties.
4242
* :star: Add `sizeToFit()` method. See [Adjusting size](#adjusting_size).
4343
* :star: PinLayout can now layout CALayer. See [CALayer Support](#calayer_support) for more information.
4444
* :star: PinLayout is in the Top 10 of Swift Layout frameworks on [Awesome Swift](https://swift.libhunt.com/categories/714-layout)
@@ -66,7 +66,7 @@ Extremely Fast views layouting without auto layout. No magic, pure code, full co
6666
* [minWidth, maxWidth, minHeight, maxHeight](#minmax_width_height_size)
6767
* [Margins](#margins)
6868
* [Aspect Ratio](#aspect_ratio)
69-
* [safeAreaInsets support](#safeAreaInsets)
69+
* [safeArea, readable and layout margins](#safeAreaInsets)
7070
* [WrapContent](#wrapContent)
7171
* [justify, align](#justify_align)
7272
* [UIView's transforms](#uiview_transform)
@@ -227,16 +227,16 @@ The following methods are used to position a view’s edge relative to its super
227227
:pushpin: The offset/margin parameter in the following methods can be either positive and negative. In general cases positive values are used.
228228

229229
* **`top(_ offset: CGFloat)`** / **`top(_ offset: Percent)`** / **`top()`** / **`top(_ margin: UIEdgeInsets)`**
230-
Position the top edge. The offset specifies the top edge distance from the superview's top edge in pixels (or in percentage of its superview's height). `top()` is similar to calling `top(0)`, it position the view top edge directly on its superview top edge. `top(:UIEdgeInsets)` use the `UIEdgeInsets.top` property, is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
230+
Position the top edge. The offset specifies the top edge distance from the superview's top edge in pixels (or in percentage of its superview's height). `top()` is similar to calling `top(0)`, it position the view top edge directly on its superview top edge. `top(:UIEdgeInsets)` use the `UIEdgeInsets.top` property, is particularly useful with [safeArea, readable and layout margins](#safeAreaInsets).
231231

232232
* **`bottom(_ offset: CGFloat)`** / **`bottom(_ offset: Percent)`** / **`bottom()`** / **`bottom(_ margin: UIEdgeInsets)`**
233-
Position the bottom edge. The offset specifies the bottom edge **distance from the superview's bottom edge** in pixels (or in percentage of its superview's height). `bottom()` is similar to calling `bottom(0)`, it position the view bottom edge directly on its superview top edge. `bottom(:UIEdgeInsets)` use the `UIEdgeInsets.bottom` property, it is is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
233+
Position the bottom edge. The offset specifies the bottom edge **distance from the superview's bottom edge** in pixels (or in percentage of its superview's height). `bottom()` is similar to calling `bottom(0)`, it position the view bottom edge directly on its superview top edge. `bottom(:UIEdgeInsets)` use the `UIEdgeInsets.bottom` property, it is is particularly useful with [safeArea, readable and layout margins](#safeAreaInsets).
234234

235235
* **`left(_ offset: CGFloat)`** / **`left(_ offset: Percent)`** / **`left()`** / **`left(_ margin: UIEdgeInsets)`**
236-
Position the left edge. The offset specifies the left edge distance from the superview's left edge in pixels (or in percentage of its superview's width). `left()` is similar to calling `left(0)`, it position the view left edge directly on its superview left edge. `left(:UIEdgeInsets)` use the `UIEdgeInsets.left` property, it is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
236+
Position the left edge. The offset specifies the left edge distance from the superview's left edge in pixels (or in percentage of its superview's width). `left()` is similar to calling `left(0)`, it position the view left edge directly on its superview left edge. `left(:UIEdgeInsets)` use the `UIEdgeInsets.left` property, it is particularly useful with [safeArea, readable and layout margins](#safeAreaInsets).
237237

238238
* **`right(_ offset: CGFloat)`** / **`right(_ offset: Percent)`** / **`right()`** / **`right(_ margin: UIEdgeInsets)`**
239-
Position the right edge. The offset specifies the right edge **distance from the superview's right edge** in pixels (or in percentage of its superview's width). `right()` is similar to calling `right(0)`, it position the view right edge directly on its superview right edge. `right(:UIEdgeInsets)` use the `UIEdgeInsets. right` property, it is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
239+
Position the right edge. The offset specifies the right edge **distance from the superview's right edge** in pixels (or in percentage of its superview's width). `right()` is similar to calling `right(0)`, it position the view right edge directly on its superview right edge. `right(:UIEdgeInsets)` use the `UIEdgeInsets. right` property, it is particularly useful with [safeArea, readable and layout margins](#safeAreaInsets).
240240

241241
* **`vCenter(_ offset: CGFloat)`** / **`vCenter(_ offset: Percent)`** / **`vCenter()`**
242242
Position the vertical center (center.y). The offset specifies the distance vertically of the view's center related to the superview's center in pixels (or in percentage of its superview's height). A positive offset move the view down and a negative value move it up relative to the superview's center. `vCenter()` is similar to calling `vCenter(0)`, it position vertically the view's center directly on its superview vertical center.
@@ -248,18 +248,18 @@ Position the horizontal center (center.x). The offset specifies the distance hor
248248

249249
* **`start(_ offset: CGFloat)`** / **`start(_ offset: Percent)`** / **`start()`** / **`start(_ margin: UIEdgeInsets)`** :left_right_arrow:
250250
Position the left or right edge depending of the LTR language direction. In LTR direction the offset specifies the left edge distance from the superview's left edge in pixels (or in percentage of its superview's width). In RTL direction the offset specifies the right edge distance from the superview's right edge in pixels (or in percentage of its superview's width).
251-
`start()` is similar to calling `start(0)`. `start(:UIEdgeInsets)` use the `UIEdgeInsets.left` property in LTR direction and `UIEdgeInsets.right` in RTL direction, it is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
251+
`start()` is similar to calling `start(0)`. `start(:UIEdgeInsets)` use the `UIEdgeInsets.left` property in LTR direction and `UIEdgeInsets.right` in RTL direction.
252252

253253
* **`end(_ offset: CGFloat)`** / **`end(_ offset: Percent)`** / **`end()`** / **`end(_ margin: UIEdgeInsets)`** :left_right_arrow:
254-
Position the left or right edge depending of the LTR language direction. In LTR direction the offset specifies the right edge distance from the superview's right edge in pixels (or in percentage of its superview's width). In RTL direction the offset specifies the left edge distance from the superview's left edge in pixels (or in percentage of its superview's width). `end()` is similar to calling `end(0)`. `end(:UIEdgeInsets)` use the `UIEdgeInsets.right` property in LTR direction and `UIEdgeInsets.left` in RTL direction, it is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
254+
Position the left or right edge depending of the LTR language direction. In LTR direction the offset specifies the right edge distance from the superview's right edge in pixels (or in percentage of its superview's width). In RTL direction the offset specifies the left edge distance from the superview's left edge in pixels (or in percentage of its superview's width). `end()` is similar to calling `end(0)`. `end(:UIEdgeInsets)` use the `UIEdgeInsets.right` property in LTR direction and `UIEdgeInsets.left` in RTL direction.
255255

256256
<a name="pin_multiple_edges"></a>
257257
**Methods pinning multiple edges**:
258258

259259
* **`all(_ margin: CGFloat)`** / **`all()`** / **`all(_ margin: UIEdgeInsets)`**
260260
Position the top, left, bottom and right edges. The margin specifies the **top, bottom, left and right edges** distance from the superview's corresponding edge in pixels. Similar to calling `view.top(value).bottom(value).left(value).right(value)`.
261261
`all()` is similar to calling `all(0)`.
262-
`all(:UIEdgeInsets)` is particularly useful with [`UIView.pin.safeArea`](#safeAreaInsets) or `UIView.safeAreaInsets`.
262+
`all(:UIEdgeInsets)` is particularly useful with [safeArea, readable and layout margins](#safeAreaInsets).
263263

264264
* **`horizontally(_ margin: CGFloat)`** / **`horizontally(_ margin: Percent)`** / **`horizontally()`** / **`horizontally(_ margin: UIEdgeInsets)`**
265265
Position the left and right edges. The margin specifies the **left and right edges** distance from its superview's corresponding edges in pixels (or in percentage of its superview's width).
@@ -930,7 +930,7 @@ Set the top and bottom margins to the specified value.
930930
* **`margin(:CGFloat)`** / **`margin(: Percent)`**
931931
Apply the value to all margins (top, left, bottom, right), in pixels or in percentage of its superview's width/height.
932932
* **`margin(:UIEdgeInsets)`**
933-
Set all margins using an UIEdgeInsets. This method is particularly useful to set all margins using iOS 11 with `UIView.safeAreaInsets` or [`UIView.pin.safeArea`](#safeAreaInsets).
933+
Set all margins using an UIEdgeInsets. This method is particularly useful to set all margins using [safeArea, readable and layout margins](#safeAreaInsets).
934934
* **`margin(_ insets: NSDirectionalEdgeInsets) `**
935935
Set all margins using an NSDirectionalEdgeInsets. This method is useful to set all margins using iOS 11 `UIView. directionalLayoutMargins` when layouting a view supporting RTL/LTR languages.
936936
* **`margin(_ vertical: CGFloat, _ horizontal: CGFloat)`**
@@ -1120,7 +1120,7 @@ This example layout an UIImageView at the top and center it horizontally, it als
11201120

11211121

11221122
<a name="safeAreaInsets"></a>
1123-
## UIKit safeArea, readable and layout margins
1123+
## safeArea, readable and layout margins
11241124

11251125
UIKit expose 3 kind of areas/guides that can be used to layout views.
11261126
PinLayout expose them using these properties:
@@ -1670,7 +1670,9 @@ PinLayout can layout **NSView**'s on macOS. All PinLayout's properties and metho
16701670

16711671
* [`sizeToFit(:FitType)`](#sizeToFit) is supported only for instances that inherits from NSControl. Support for [`sizeToFit(:FitType)`](#sizeToFit) can be added to your custom NSView subclasses, just make those views conform to the `SizeCalculable` protocol and implement the two required functions.
16721672

1673-
* [`NSView.pin.safeArea`](#safeAreaInsets) property is not available, AppKit doesn't have an `UIView.safeAreaInsets` equivalent.
1673+
* [`NSView.pin.safeArea` and ](#safeAreaInsets) property is not available, AppKit doesn't have an `UIView.safeAreaInsets` equivalent.
1674+
1675+
* [`NSView.pin.readableMargins`](#safeAreaInsets) property is not available, AppKit doesn't have an `UIView.readableContentGuide` equivalent.
16741676

16751677
* [`aspectRatio()`](#aspect_ratio) with no parameters.
16761678

@@ -1683,7 +1685,7 @@ PinLayout can layout **NSView**'s on macOS. All PinLayout's properties and metho
16831685
PinLayout can layouts **CALayer**'s. All PinLayout's properties and methods are available, with the following exceptions:
16841686

16851687
* [`sizeToFit(:FitType)`](#sizeToFit) is not supported. Support for [`sizeToFit(:FitType)`](#sizeToFit) can be added to your custom CALayer subclasses, just make those layers conform to the `SizeCalculable` protocol and implement the two required functions.
1686-
* [`CALayer.pin.safeArea`](#safeAreaInsets) property is not available.
1688+
* [`CALayer.pin.safeArea` and `CALayer.pin.readableMargins`](#safeAreaInsets) properties are not available.
16871689
* [`aspectRatio()`](#aspect_ratio) with no parameters
16881690

16891691
###### Usage Examples:

0 commit comments

Comments
 (0)