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
The performance are really incredible, I didn’t know they would be that great.
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 is also realy fast, slightly slower than PinLayout and manual layouting.
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), ...).
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. And all these results are on a iPhone 6S device.
PinLayout's performance has been tested using a fork of [LayoutKit](https://github.com/mirego/LayoutKit). LayoutKit's example app include a really nice benchmark.
11
+
12
+
The benchmark has been modified to also include PinLayout. [See PinLayout implementation source code](https://github.com/mirego/LayoutKit/blob/master/LayoutKitSampleApp/Benchmarks/FeedItemPinLayoutView.swift). Remark that PinLayout's layout code is concise, clean and doesn't contain any computation in `layoutSubviews()`, compared to [Manual Layouting source code](https://github.com/mirego/LayoutKit/blob/master/LayoutKitSampleApp/Benchmarks/FeedItemManualView.swift)
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 is also realy 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. And all these results are 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>
46
+
</p>
47
+
48
+
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, which has been developped to compared LayoutKit performance over UIStackView, Auto layout and manual layouting. [PinLayout has been added to this benchmark](https://github.com/mirego/LayoutKit)
79
+
to compare its performance.
77
80
78
-
To integrate PinLayout into your Xcode project using CocoaPods, specify it in your `Podfile`:
81
+
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**.
79
82
80
-
```ruby
81
-
pod 'PinLayout'
82
-
```
83
+
These results also means that **PinLayout is by far faster than any layout frameworks that is built over auto layout**.
83
84
84
-
Then, run `pod install`.
85
-
86
-
### Carthage
87
-
88
-
To integrate PinLayout into your Xcode project using Carthage, specify it in your `Cartfile`:
89
-
90
-
```ogdl
91
-
github "mirego/PinLayout"
92
-
```
85
+
[More details and explanation of the benchmark](Docs/Benchmark)
93
86
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:10px;">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.
123
+
: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
124
138
125
: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
126
140
127
<br/>
141
128
142
-
143
129
# Documentation <aname="documentation"></a>
144
130
145
131
## Layout using distances from superview’s edges <aname="distance_from_superview_edge"></a>
@@ -788,6 +774,40 @@ Cell D:
788
774
789
775
<br>
790
776
777
+
## Installation <aname="installation"></a>
778
+
779
+
### CocoaPods
780
+
781
+
To integrate PinLayout into your Xcode project using CocoaPods, specify it in your `Podfile`:
782
+
783
+
```ruby
784
+
pod 'PinLayout'
785
+
```
786
+
787
+
Then, run `pod install`.
788
+
789
+
### Carthage
790
+
791
+
To integrate PinLayout into your Xcode project using Carthage, specify it in your `Cartfile`:
792
+
793
+
```ogdl
794
+
github "mirego/PinLayout"
795
+
```
796
+
797
+
Then, run `carthage update` to build the framework and drag the built `PinLayout.framework` into your Xcode project.
798
+
799
+
### Swift Package Manager
800
+
801
+
Once you have your Swift package set up, you only need to add PinLayout as a dependency of your `Package.swift`.
0 commit comments