LayoutKit
Nested Layouts
該項目不再由LinkedIn使用,目前不受歡迎。
Layoutkit是iOS,MacOS和TVOS的快速視圖佈局庫。
LinkedIn創建了Layoutkit,因為我們發現自動佈局的性能不足以使可滾動視圖中的複雜視圖層次結構。有關更多背景,請閱讀博客文章。
Layoutkit在使用自動佈局方面有很多好處:
Layoutkit還提供了使其易於使用的好處,例如自動佈局:
let image = SizeLayout < UIImageView > ( width : 50 , height : 50 , config : { imageView in
imageView . image = UIImage ( named : " earth.jpg " )
} )
let label = LabelLayout ( text : " Hello World! " , alignment : . center )
let stack = StackLayout (
axis : . horizontal ,
spacing : 4 ,
sublayouts : [ image , label ] )
let insets = UIEdgeInsets ( top : 4 , left : 4 , bottom : 4 , right : 8 )
let helloWorld = InsetLayout ( insets : insets , sublayout : stack )
helloWorld . arrangement ( ) . makeViews ( in : rootView ) 
我們發現Layoutkit是一個有用的工具,但是您應該意識到它不是什麼。
Layoutkit可以用可可腳類或迦太基安裝。
將其添加到您的podspec中:
pod 'LayoutKit'
然後運行pod install 。
將其添加到您的卡特菲爾:
github "linkedin/LayoutKit"
然後運行carthage update 。
現在,您準備開始構建UI。