You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PinLayout's performance has been tested using a fork of [LayoutKit](https://github.com/mirego/LayoutKit). LayoutKit include an example app with a really nice and simple benchmark. It is used to compare LayoutKit with Auto layout, UIStackViews and manual layouting.
11
+
12
+
The benchmark has been modified to also include [PinLayout](https://github.com/mirego/LayoutKit/blob/master/LayoutKitSampleApp/Benchmarks/FeedItemPinLayoutView.swift). Remark in the implemantation that PinLayout's layout code is concise, clean and doesn't contain any computation [compared to Manual Layouting source code](Benchmark-PinLayout-SourceCode.md).
13
+
14
+
The benchmark include tests for the following layout systems:
15
+
16
+
* Auto layout
17
+
* Auto layout using UIStackViews
18
+
* LayoutKit
19
+
* Manual layout (i.e. set UIView's frame directly)
20
+
* PinLayout
21
+
22
+
Anyone who would like to integrate any other layout frameworks to this GitHub repository is welcome.
23
+
24
+
##### Benchmark details
25
+
The LayoutKit benchmark layout UICollectionView and UITableView cells in multiple pass, each pass contains more cells than the previous one. The **X axis** in following charts indicates the number of cell contained for each pass. The **Y axis** indicates the number of miliseconds to render all cells from one pass.
26
+
27
+
Here are the rendering results to compare visual results:
As you can see in the following chart, PinLayout's performance is as fast as manual layouting, and up to **12x faster than auto layout**, and **16x faster than UIStackViews**. [LayoutKit](https://github.com/linkedin/LayoutKit) is also really fast, slightly slower than PinLayout and manual layouting.
36
+
37
+
These results also means that PinLayout is by far faster than any layout frameworks that is built over auto layout ([SnapKit](https://github.com/SnapKit/SnapKit), [Stevia](https://github.com/freshOS/Stevia), [PureLayout](https://github.com/PureLayout/PureLayout), ...).
38
+
39
+
It takes almost half a second (0.468 ms) to render 100 UICollectionView's cells using UIStackViews, and 1/3 of second (0.344) using auto layout on a iPhone 6S device.
<palign="center"style="font-size:10px;">X axis in the number cells in a UICollectionView, and Y axis is the time in miliseconds to layout all cells.</p>
47
+
</p>
48
+
49
+
You can have a look at the [spreadsheet containing all the data](Benchmark/Benchmark-iPhone6S.xlsx)
PinLayout's performance has been measured using the excellent LayoutKit benchmark. PinLayout has been added to this benchmark to compare its performance.
85
79
86
-
### Carthage
80
+
As you can see in the following chart, PinLayout's performance is as fast as manual layouting, and up to **12x faster than auto layout**, and **16x faster than UIStackViews**.
87
81
88
-
To integrate PinLayout into your Xcode project using Carthage, specify it in your `Cartfile`:
82
+
These results also means that **PinLayout is by far faster than any layout frameworks that is built over auto layout**.
89
83
90
-
```ogdl
91
-
github "mirego/PinLayout"
92
-
```
84
+
[More details and explanation of the benchmark](Docs/Benchmark.md)
93
85
94
-
Then, run `carthage update` to build the framework and drag the built `PinLayout.framework` into your Xcode project.
95
-
96
-
### Swift Package Manager
97
-
98
-
Once you have your Swift package set up, you only need to add PinLayout as a dependency of your `Package.swift`.
<palign="center"style="font-size:9px;">X axis in the number cells in a UICollectionView, and Y axis is the time in miliseconds to layout all cells.</p>
:pushpin: This example and some other examples are available in the **PinLayoutSample** project. Please note that you must do a `pod install` before running the sample project.
122
+
:pushpin: This example and some other examples are available in the **Example** project. Please note that you must do a `pod install` before running the example project.
137
123
138
124
:pushpin: PinLayout doesn't use auto layout constraints, it is a framework that manually layout views. For that reason you need to update the layout inside either `UIView.layoutSubviews()` or `UIViewController.viewDidLayoutSubviews()` to handle container size's changes, including device rotation. You'll also need to handle UITraitCollection changes for app's that support multitask. In the example above PinLayout's commands are inside UIView's `layoutSubviews()` method.
139
125
140
126
<br/>
141
127
142
-
143
128
# Documentation <aname="documentation"></a>
144
129
145
130
## Layout using distances from superview’s edges <aname="distance_from_superview_edge"></a>
@@ -788,6 +773,40 @@ Cell D:
788
773
789
774
<br>
790
775
776
+
## Installation <aname="installation"></a>
777
+
778
+
### CocoaPods
779
+
780
+
To integrate PinLayout into your Xcode project using CocoaPods, specify it in your `Podfile`:
781
+
782
+
```ruby
783
+
pod 'PinLayout'
784
+
```
785
+
786
+
Then, run `pod install`.
787
+
788
+
### Carthage
789
+
790
+
To integrate PinLayout into your Xcode project using Carthage, specify it in your `Cartfile`:
791
+
792
+
```ogdl
793
+
github "mirego/PinLayout"
794
+
```
795
+
796
+
Then, run `carthage update` to build the framework and drag the built `PinLayout.framework` into your Xcode project.
797
+
798
+
### Swift Package Manager
799
+
800
+
Once you have your Swift package set up, you only need to add PinLayout as a dependency of your `Package.swift`.
0 commit comments