All Projects → kishikawakatsumi → Ibpcollectionviewcompositionallayout

kishikawakatsumi / Ibpcollectionviewcompositionallayout

Licence: mit
Backport of UICollectionViewCompositionalLayout to earlier iOS 12

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Ibpcollectionviewcompositionallayout

Squaremosaiclayout
An extandable mosaic UICollectionViewLayout with a focus on extremely flexible customizations 🔶
Stars: ✭ 243 (-76.5%)
Mutual labels:  uikit, uicollectionviewlayout
Collectionviewpaginglayout
a simple but highly customizable paging layout for UICollectionView.
Stars: ✭ 947 (-8.41%)
Mutual labels:  uikit, uicollectionviewlayout
Alignedcollectionviewflowlayout
A collection view layout that gives you control over the horizontal and vertical alignment of the cells.
Stars: ✭ 751 (-27.37%)
Mutual labels:  uikit, uicollectionviewlayout
Collectionviewslantedlayout
A CollectionView Layout displaying a slanted cells
Stars: ✭ 2,029 (+96.23%)
Mutual labels:  uikit, uicollectionviewlayout
Compositional Layouts Kit
📏 A set of advanced compositional layouts for UICollectionView with examples [Swift 5.3, iOS 13].
Stars: ✭ 317 (-69.34%)
Mutual labels:  uikit, uicollectionviewlayout
Uicollectionview Layouts Kit
📐 A set of custom layouts for UICollectionView with examples [Swift 5.3, iOS 12].
Stars: ✭ 410 (-60.35%)
Mutual labels:  uikit, uicollectionviewlayout
Pagingkit
PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries.
Stars: ✭ 1,030 (-0.39%)
Mutual labels:  uikit, uicollectionviewlayout
C4ios
C4 is an open-source creative coding framework that harnesses the power of native iOS programming with a simplified API that gets you working with media right away. Build artworks, design interfaces and explore new possibilities working with media and interaction.
Stars: ✭ 952 (-7.93%)
Mutual labels:  uikit
Parallaxscrolling
Parallax Scrolling
Stars: ✭ 36 (-96.52%)
Mutual labels:  uikit
Qmuidemo ios
Sample Code for QMUI iOS
Stars: ✭ 912 (-11.8%)
Mutual labels:  uikit
Tkswitchercollection
An animation switch collection
Stars: ✭ 877 (-15.18%)
Mutual labels:  uikit
Peel Off Animation Example Code
Example code for https://robb.is/working-on/a-peel-off-animation
Stars: ✭ 37 (-96.42%)
Mutual labels:  uikit
Availity Uikit
Availity UI Kit powered by Bootstrap 4
Stars: ✭ 44 (-95.74%)
Mutual labels:  uikit
H5ui
Lightweight, elegant open source mobile UI style library.
Stars: ✭ 44 (-95.74%)
Mutual labels:  uikit
Centeredcollectionview
A lightweight UICollectionViewLayout that 'pages' and centers its cells 🎡 written in Swift
Stars: ✭ 965 (-6.67%)
Mutual labels:  uicollectionviewlayout
Viewcomposer
Compose views using enums swiftly: `let label: UILabel = [.text("Hello"), .textColor(.red)]`
Stars: ✭ 27 (-97.39%)
Mutual labels:  uikit
Swifthuecolorpicker
iOS HUE color picker
Stars: ✭ 44 (-95.74%)
Mutual labels:  uikit
Weekdayssegmentedcontrol
A Custom segmented control to select weekdays for iOS
Stars: ✭ 14 (-98.65%)
Mutual labels:  uikit
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (-6.87%)
Mutual labels:  uikit
Spalert
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.
Stars: ✭ 1,014 (-1.93%)
Mutual labels:  uikit

Languages Release CocoaPods Carthage MIT License Bitrise


IBPCollectionViewCompositionalLayout

Backport of UICollectionViewCompositionalLayout to earlier iOS 12.

A new UICollectionViewCompositionalLayout class has been added to UIKit to make it incredibly easier to create custom complex collection view layout. You can use new excellent APIs immediately without maintaining two different code bases until iOS 13 would be widely adopted.

Note: that this library is still currently under active development. Please file all bugs, issues, and suggestions as an Issue in the GitHub repository.

What is Collection View Compositional Layouts?

At the WWDC 2019, Apple introduced a new form of UICollectionViewLayout. A new UICollectionViewCompositionalLayout class has been added to UIKit to make it easier to create compositional layouts without requiring a custom UICollectionViewLayout.

In iOS 12 and earlier, we need subclassing of UICollectionViewLayout to do that. We have to override lots of methods correctly, and it is error-prone.

With Collection View Compositional Layouts, you can make very complex layout even nested collection views with independently scrolling sections just within few lines of code.

See also:

Screenshots

Nested Group Orthogonal Scroll Orthogonal Scroll
screenshot screenshot screenshot
List Grid Inset Grid Column
screenshot screenshot screenshot screenshot
Distinct Sections Badges Nested Groups
screenshot screenshot screenshot
Mosaic Tile Grid Banner Tile Grid Portlait Tile Grid
screenshot screenshot screenshot screenshot

Usage

Copy IBPCollectionViewCompositionalLayout/IBPCollectionViewCompositionalLayoutInteroperability.swift file to your project. It tricks the compiler to make the same code base available for iOS 13 and earlier than iOS 12.

Import IBPCollectionViewCompositionalLayout.

Then you can use Collection View Compositonal Layouts API as-is.

import IBPCollectionViewCompositionalLayout

let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
                                     heightDimension: .fractionalHeight(1))
let item = NSCollectionLayoutItem(layoutSize: itemSize)

let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
                                      heightDimension: .absolute(44))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])

let section = NSCollectionLayoutSection(group: group)

let layout = UICollectionViewCompositionalLayout(section: section)

let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
...

IBPCollectionViewCompositionalLayoutInteroperability.swift

This file silences the following compilation errors when building on Xcode 11 or higher environment.

'UICollectionViewCompositionalLayout' is only available in iOS 13.0 or newer

Features

  • [x] Inter Item Spacing
  • [x] Inter Group Spacing
  • [x] Inter Section Spacing
  • [x] Fixed Spacing
  • [x] Flexible Spacing
  • [x] Nested Groups
  • [x] Vertical Scrolling
  • [x] Horizontal Scrolling
  • [x] Supplemental Views (e.g. Section Header/Footers)
  • [x] Pinned Section Header/Footers
  • [x] Decoration Views (e.g. Background Views)
  • [x] Orthogonal Scrolling
  • [x] Orthogonal Scrolling Behavior
  • [x] Estimated Size (Autosizing)
  • [x] Custom Group Item (Absolute Positions)
  • [x] Drop-in replacement

TODOs (Not yet supported)

  • [ ] RTL Support
  • [ ] Visual Debug Description
  • [ ] Performance Optimization

Requirements

  • Swift 5.0+ or Objective-C
  • iOS 10.0+

Installation

CocoaPods

Add the following to your Podfile:

pod 'IBPCollectionViewCompositionalLayout'

Carthage

Add the following to your Cartfile:

github "kishikawakatsumi/IBPCollectionViewCompositionalLayout"

Special Thanks

Thanks to Ryo Aoyama, the author of DiffableDataSources. A backport library of Diffable Data Sources. It is used in the sample code.

Thanks to Astemir Eleev. Most of the sample code are borrowed from his uicollectionview-layouts-kit.

Author

Kishikawa Katsumi

Licence

The project is available under MIT Licence

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].