devxoul / Ascollectionflexlayout
Licence: mit
A custom collection layout that allows to use Texture layout specs in ASCollectionNode.
Stars: ✭ 24
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Ascollectionflexlayout
Layout
Single-file library for calculating 2D UI layouts using stacking boxes. Compiles as C99 or C++.
Stars: ✭ 551 (+2195.83%)
Mutual labels: flexbox
Android 3d Model Viewer
Android OpenGL 2.0 application to view 3D models. Published on Play Store
Stars: ✭ 809 (+3270.83%)
Mutual labels: texture
Angular Split
🍌 Angular UI library to split views and allow dragging to resize areas using CSS flexbox layout.
Stars: ✭ 582 (+2325%)
Mutual labels: flexbox
Flex Layout
Provides HTML UI layout for Angular applications; using Flexbox and a Responsive API
Stars: ✭ 5,705 (+23670.83%)
Mutual labels: flexbox
Split
Unopinionated utilities for resizeable split views
Stars: ✭ 5,176 (+21466.67%)
Mutual labels: flexbox
Luminance Rs
Type-safe, type-level and stateless Rust graphics framework
Stars: ✭ 632 (+2533.33%)
Mutual labels: texture
Swiftspreadsheet
Spreadsheet CollectionViewLayout in Swift. Fully customizable. 🔶
Stars: ✭ 590 (+2358.33%)
Mutual labels: uicollectionviewlayout
Matcaps
Huge library of matcap PNG textures organized by color
Stars: ✭ 607 (+2429.17%)
Mutual labels: texture
Paralayout
Paralayout is a set of simple, useful, and straightforward utilities that enable pixel-perfect layout in iOS. Your designers will love you.
Stars: ✭ 742 (+2991.67%)
Mutual labels: flexbox
Texture Vs Shape
Pre-trained models, data, code & materials from the paper "ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness" (ICLR 2019 Oral)
Stars: ✭ 556 (+2216.67%)
Mutual labels: texture
Flex Layout Attribute
HTML layout helper based on CSS flexbox specification —
Stars: ✭ 705 (+2837.5%)
Mutual labels: flexbox
React Flex Ready
A Flexbox grid ready, easy to implement and customize
Stars: ✭ 23 (-4.17%)
Mutual labels: flexbox
Alignedcollectionviewflowlayout
A collection view layout that gives you control over the horizontal and vertical alignment of the cells.
Stars: ✭ 751 (+3029.17%)
Mutual labels: uicollectionviewlayout
ASCollectionFlexLayout
ASCollectionFlexLayout is a custom collection layout that allows to use Texture layout specs in ASCollectionNode.
Usage
Creating a layout
let layout = ASCollectionFlexLayout()
layout.layoutProvider = self
let collectionNode = ASCollectionNode(collectionViewLayout: layout)
If you don't specify the layoutProvider
, it will use a ASStackLayout
as default.
Implementing ASCollectionFlexLayoutProvider protocol
There are two kind of layout specs in ASCollectionFlexLayout:
- A layout for sections
- A Layout for items in a section
You can optionally provide each layout specs by implementing ASCollectionFlexLayoutProvider
protocol.
protocol ASCollectionFlexLayoutProvider {
/// A layout spec for sections. The default layout spec is a stretched stack layout with no spacing.
func flexLayout(_ layout: ASCollectionFlexLayout, layoutSpecThatFits constrainedSize: ASSizeRange, sectionElements: [ASLayoutElement]) -> ASLayoutSpec?
/// A layout spec for items in a section. The default layout spec is a flex-wrapping stack with no spacing.
func flexLayout(_ layout: ASCollectionFlexLayout, layoutSpecThatFits constrainedSize: ASSizeRange, forSectionAt section: Int, itemElements: [ASLayoutElement]) -> ASLayoutSpec?
}
For example:
extension MyViewController: ASCollectionFlexLayoutProvider {
func flexLayout(_ layout: ASCollectionFlexLayout, layoutSpecThatFits constrainedSize: ASSizeRange, sectionElements: [ASLayoutElement]) -> ASLayoutSpec? {
return ASStackLayoutSpec(
direction: .vertical,
spacing: 20,
justifyContent: .start,
alignItems: .start,
children: sectionElements
)
}
func flexLayout(_ layout: ASCollectionFlexLayout, layoutSpecThatFits constrainedSize: ASSizeRange, forSectionAt section: Int, itemElements: [ASLayoutElement]) -> ASLayoutSpec? {
return ASStackLayoutSpec(
direction: .horizontal,
spacing: 10,
justifyContent: .start,
alignItems: .start,
flexWrap: .wrap,
alignContent: .start,
lineSpacing: 10,
children: itemElements
)
}
}
Using the default layout
You can modify the default layout to apply layout without implementing ASCollectionFlexLayoutProvider
protocol.
let layout = ASCollectionFlexLayout()
layout.defaultSectionLayout.alignItems = .center
layout.defaultItemLayout.direction = .vertical
layout.defaultItemLayout.alignItems = .stretch
Also you can directly refer to the default layout in the ASCollectionFlexLayoutProvider
protocol implementation.
func flexLayout(_ layout: ASCollectionFlexLayout, layoutSpecThatFits constrainedSize: ASSizeRange, forSectionAt section: Int, itemElements: [ASLayoutElement]) -> ASLayoutSpec? {
let insets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 20)
return ASInsetLayoutSpec(insets: insets, child: layout.defaultItemLayout)
}
License
ASCollectionFlexLayout is under MIT license. See the LICENSE for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].