All Projects → devxoul → Uicollectionviewflexlayout

devxoul / Uicollectionviewflexlayout

Licence: mit
A drop-in replacement for UICollectionViewFlowLayout

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Uicollectionviewflexlayout

CollectionLayouts
A collection of UICollectionViewLayouts
Stars: ✭ 64 (-76.9%)
Mutual labels:  uicollectionview, uicollectionviewlayout
JQCollectionViewAlignLayout
A custom layout object based on flow layout. Added supports for horizontal, vertical alignment and RTL direction of collection view items.(available for both UICollectionView and NSCollectionView)
Stars: ✭ 69 (-75.09%)
Mutual labels:  uicollectionview, uicollectionviewlayout
Admozaiccollectionviewlayout
ADMozaicCollectionViewLayout is yet another UICollectionViewLayout subclass that implements "brick", "mozaic" or Pinterest style layout.
Stars: ✭ 226 (-18.41%)
Mutual labels:  uicollectionviewlayout, uicollectionview
HorizontalStickyHeaderLayout
Horizontal UICollectionViewLayout with Sticky HeaderView
Stars: ✭ 70 (-74.73%)
Mutual labels:  uicollectionview, uicollectionviewlayout
ExcelCollectionViewLayout
An Excel-like UICollectionView's layout.
Stars: ✭ 32 (-88.45%)
Mutual labels:  uicollectionview, uicollectionviewlayout
Collectionviewslantedlayout
A CollectionView Layout displaying a slanted cells
Stars: ✭ 2,029 (+632.49%)
Mutual labels:  uicollectionviewlayout, uicollectionview
CPCollectionViewWheelLayoutSwift
New url:https://github.com/ParsifalC/CPCollectionViewKit Objective-C Version:https://github.com/ParsifalC/CPCollectionViewWheelLayout
Stars: ✭ 16 (-94.22%)
Mutual labels:  uicollectionview, uicollectionviewlayout
Flowlayout
UICollectionView WaterFlowLayout. 瀑布流.
Stars: ✭ 94 (-66.06%)
Mutual labels:  uicollectionviewlayout, uicollectionview
CollectionViewMultiColumnLayout
A tiled waterfal/mosaic UICollectionViewLayout with support for explicit columns.
Stars: ✭ 13 (-95.31%)
Mutual labels:  uicollectionview, uicollectionviewlayout
CSStickyFlowLayoutHeaders
UICollectionView replacement for your amazing headers
Stars: ✭ 16 (-94.22%)
Mutual labels:  uicollectionview, uicollectionviewlayout
ScaledCenterCarousel
A carousel-based layout for UICollectionView with scaled center item.
Stars: ✭ 16 (-94.22%)
Mutual labels:  uicollectionview, uicollectionviewlayout
ScrollAnimationShowcase
[ING] - UIScrollViewやUICollectionViewの特性を活用した表現サンプル
Stars: ✭ 15 (-94.58%)
Mutual labels:  uicollectionview, uicollectionviewlayout
Lxreorderablecollectionviewflowlayout
Extends `UICollectionViewFlowLayout` to support reordering of cells. Similar to long press and pan on books in iBook.
Stars: ✭ 1,831 (+561.01%)
Mutual labels:  uicollectionviewlayout, uicollectionview
Chatlayout
ChatLayout is an alternative solution to MessageKit. It uses custom UICollectionViewLayout to provide you full control over the presentation as well as all the tools available in UICollectionView. It supports dynamic cells and supplementary view sizes.
Stars: ✭ 184 (-33.57%)
Mutual labels:  uicollectionviewlayout, uicollectionview
Cpcollectionviewkit
Interesting UICollectionView layouts and transitions
Stars: ✭ 140 (-49.46%)
Mutual labels:  uicollectionviewlayout, uicollectionview
Squaremosaiclayout
An extandable mosaic UICollectionViewLayout with a focus on extremely flexible customizations 🔶
Stars: ✭ 243 (-12.27%)
Mutual labels:  uicollectionviewlayout, uicollectionview
Drcollectionviewtablelayout Ios
UICollectionView 2d-table / grid / spreadsheet layout
Stars: ✭ 74 (-73.29%)
Mutual labels:  uicollectionviewlayout, uicollectionview
Bubblecollectionviewlayout
Create bubble layout of UICollectionView using custom layout
Stars: ✭ 79 (-71.48%)
Mutual labels:  uicollectionviewlayout, uicollectionview
CPCollectionViewWheelLayout
An interesting wheel layout of collection view.Swift version:https://github.com/ParsifalC/CPCollectionViewKit
Stars: ✭ 16 (-94.22%)
Mutual labels:  uicollectionview, uicollectionviewlayout
iOSEasyList
A data-driven UICollectionView and UITableView framework for building fast and flexible lists
Stars: ✭ 29 (-89.53%)
Mutual labels:  uicollectionview, uicollectionviewlayout

UICollectionViewFlexLayout

Swift CocoaPods Build Status Codecov

UICollectionViewFlexLayout is a drop-in replacement for UICollectionViewFlowLayout.

Features

  • [x] Section Spacing
  • [x] Section Margin
  • [x] Section Padding
  • [x] Section Background
  • [x] Item Spacing
  • [x] Item Margin
  • [x] Item Padding
  • [x] Item Size
  • [x] Item Background
  • [x] Item Z-Index

Basic Concept

Don't let cells have margins and paddings. Cell metrics are now set outside of the cell. Just focus on contents.

idea

Usage

UICollectionViewDelegateFlexLayout

protocol UICollectionViewDelegateFlexLayout {
  // section vertical spacing
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, verticalSpacingBetweenSectionAt section: Int, and nextSection: Int) -> CGFloat

  // section margin
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, marginForSectionAt section: Int) -> UIEdgeInsets

  // section padding
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, paddingForSectionAt section: Int) -> UIEdgeInsets

  // item horizontal spacing
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, horizontalSpacingBetweenItemAt indexPath: IndexPath, and nextIndexPath: IndexPath) -> CGFloat

  // item vertical spacing
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, verticalSpacingBetweenItemAt indexPath: IndexPath, and nextIndexPath: IndexPath) -> CGFloat

  // item margin
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, marginForItemAt indexPath: IndexPath) -> UIEdgeInsets

  // item padding
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, paddingForItemAt indexPath: IndexPath) -> UIEdgeInsets

  // item size
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, sizeForItemAt indexPath: IndexPath) -> CGSize

  // item z-index
  func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewFlexLayout, zIndexForItemAt indexPath: IndexPath) -> Int
}

Section and Item Background

// register
collectionView.register(MySectionBackgroundView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionBackground, withReuseIdentifier: "mySectionBackgroundView")
collectionView.register(MyItemBackgroundView.self, forSupplementaryViewOfKind: UICollectionElementKindItemBackground, withReuseIdentifier: "myItemBackgroundView")

// configure
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
  switch kind {
  case UICollectionElementKindSectionBackground: // section background
    return collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionBackground, withReuseIdentifier: "mySectionBackgroundView", for: indexPath)

  case UICollectionElementKindItemBackground: // item background
    return collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindItemBackground, withReuseIdentifier: "myItemBackgroundView", for: indexPath)

  case foo: // else
    return bar
  }
}

Tips and Tricks

  • Using with RxCocoa

    If you're using UICollectionView with RxSwift and RxCocoa, you should create an extension of _RXDelegateProxy class to support delegate proxy.

    import RxCocoa
    import UICollectionViewFlexLayout
    
    extension _RXDelegateProxy: UICollectionViewDelegateFlexLayout {
    }
    

Contributing

$ swift package generate-xcodeproj

License

UICollectionViewFlexLayout is under MIT license. See the LICENSE file 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].