A lightweight UICollectionViewLayout that 'pages' and centers its cells 🎡 written in Swift

Overview

CenteredCollectionView

Build Status Version Carthage compatible SwiftPM compatible Swift 5.0 Platform

CenteredCollectionView is a lightweight drop in place UICollectionViewFlowLayout that pages and keeps its cells centered, resulting in the "carousel effect" 🎡

Example

Demo

To try the example using Cocoapods:

pod try CenteredCollectionView

Requirements

This pod requires a deployment target of iOS 9.0 or greater

Installation

CenteredCollectionView is available through Swift Package Manager, CocoaPods and Carthage.

To install it with Swift Package Manager, add the URL https://github.com/BenEmdon/CenteredCollectionView in Xcode Add Package Dependency assistant ; or add to your own Package.swift:

dependencies: [
  .package(url: "https://github.com/BenEmdon/CenteredCollectionView", from: "2.2.2")
]

To install it with Cocoapods, add the following line to your Podfile:

pod "CenteredCollectionView"

To install it with Carthage, add the following line to your Cartfile:

github "BenEmdon/CenteredCollectionView"

Usage

Checkout USAGE.md

API

Checkout API.md

Contributing

Have a suggestion? All contributions are welcome!

If you make a pull request or an issue, you're likely to get a swift response!

Author

@BenEmdon 👨‍💻

License

CenteredCollectionView is available under the MIT license. See the LICENSE file for more info.

Comments
  •  First cell not centered before touch (iOS 13)

    First cell not centered before touch (iOS 13)

    Describe the bug The collection is not vertically centered correctly when the view appears. The collection centers itself once I touch it (slide).

    To Reproduce Steps to reproduce the behavior:

    1. Installa Catalina and Xcode Version 11.0 beta 5
    2. Use pod try CenteredCollectionView
    3. Run project
    4. Try programmatic or storyboard examples

    Expected behavior Vertically centered collection view

    Screenshots

    Before Slide:

    After slide:

    Smartphone

    • Device: iPhone Xs Simulator
    • OS: 13.0
    • Version beta

    Additional context This bug only occurs on the beta version of iOS 13. (iPhone Xs Simulator 13.0). Everything is fine with iOS 12.

    bug help wanted stale crypto reward 💰 
    opened by dannyalbuquerque 13
  • How to integrate this pod with Storyboard?

    How to integrate this pod with Storyboard?

    So I have been working around with this pod for a day by now. I wanted the UI really bad for my collection view. I tried giving my collection view on my storyboard the CenteredCollectionView class after pod install but nope. That did not work. If you don't mind sharing how to make this work with Storyboard, it will make a world of a difference. Thanks.

    question 
    opened by jayvenn 7
  • Support iOS 13

    Support iOS 13

    Right now it appears that CenteredCollectionView doesn't support iOS 13 (ref #53). If anyone in the community of users would like to spare a hand, I would be more than happy to review and merge the code to make CenteredCollectionView support iOS 13.

    I'll buy the person that upgrades this some coffee (via a crypto transfer).

    I am also looking for a co-maintainer, if anyone is interested 👀

    help wanted crypto reward 💰 
    opened by BenEmdon 6
  • Storyboard integration example

    Storyboard integration example

    It would nice to have an example to show how to integrate this framework with storyboards. Since storyboards are very popular it would be very beneficial for the future of this project.

    I hope to get around to this at some point but am very busy, so if someone in the community could lend a hand it would be greatly appreciated.

    enhancement 
    opened by BenEmdon 5
  • Why is this line needed?

    Why is this line needed?

    https://github.com/BenEmdon/CenteredCollectionView/blob/f2bf371dae314b46f1bc03c222861c9fc40fff32/CenteredCollectionView/Classes/CenteredCollectionViewFlowLayout.swift#L114

    Hi, nice library you have there. I've been wondering what is the use of that check here? it seems to be checking if the new offset doesn't lie within the natural bounds, and handle that. But isn't this already solved by the default bouncing behavior? I commented out that check, and the demo worked fine.

    question stale 
    opened by ahmedk92 4
  • Convert to Swift 4.2

    Convert to Swift 4.2

    When using the pod, Xcode gives a warning that the project isn't Swift 4.2. I tested the automatic converter of Xcode, and it looks like everything would still work. So probably a very minor change. screenshot 2018-11-25 at 19 17 17

    help wanted 
    opened by UsefulJeroen 4
  • Cell not centered

    Cell not centered

    Describe the bug The cell is not in center, but if i scroll the collection manuallt, the cell stops at center. Please check image.

    Expected behavior Cell should initially appear in center

    Screenshots

    img_0056 img_0057

    opened by ChitvanSaxena 4
  • Support Swift Package Manager

    Support Swift Package Manager

    Is your feature request related to a problem? Please describe. Xcode 11 enabled SPM to be used as a dependency manager. Since then, SPM support for libraries would be nice ; especially for One-Class libraries like this one :)

    Describe the solution you'd like Create a Package.swift file ; to enable SPM support

    Describe alternatives you've considered Cocoapods & Carthage are nice, but they feel heavy for small projects

    Additional context If I have spare time in the next few days, I'll submit a tested PR myself ; I could use this nice minimalist lib for a side project I wanna start ;)

    opened by Dean151 3
  • Is it possible to start the collectionView first cell at the beginning of the list and not centred ?

    Is it possible to start the collectionView first cell at the beginning of the list and not centred ?

    Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

    Describe the solution you'd like A clear and concise description of what you want to happen.

    Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

    Additional context Add any other context or screenshots about the feature request here.

    opened by AlaeddineOuerteni 3
  • How to scale cells?

    How to scale cells?

    Hey! I'm not good at flow layout, please help me with my task. I need something like that: default So I need to scale cells where user scroll the collectionView. How can I do that, through edit your layout? Thanks!

    help wanted question stale 
    opened by Banck 3
  • didChangeCenteredPage ?

    didChangeCenteredPage ?

    Is there anyway to implement a function like didChangeCenteredPage() or something?

    I have animations occurring in each of my Collection View Cells but only want the animation to happen when the Cell becomes centered.

    Thanks for your help -Alex

    question 
    opened by 16alexanders 3
Releases(2.2.2)
Owner
Ben Emdon
Busy creating issues at GitHub 📝 he/him
Ben Emdon
BouncyLayout is a collection view layout that makes your cells bounce.

BouncyLayout is a collection view layout that makes your cells bounce. Features Pure Swift 5. Works with every UICollectionView. Horizontal and vertic

Robert-Hein Hooijmans 4.2k Jan 5, 2023
A CollectionView Layout displaying a slanted cells

CollectionViewSlantedLayout is a subclass of the UICollectionViewLayout allowing the display of slanted cells in a UICollectionView. Features Pure Swi

Yassir Barchi 2.2k Dec 27, 2022
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.

SWIFT OBJECTIVE-C FSPagerView is an elegant Screen Slide Library implemented primarily with UICollectionView. It is extremely helpful for making Banne

Wenchao Ding 6.7k Jan 2, 2023
↕️ VegaScroll is a lightweight animation flowlayout for UICollectionView completely written in Swift 4, compatible with iOS 11 and Xcode 9.

Made by Applikey Solutions Find this project on Dribbble Also check another flowlayout for UICollectionView: https://github.com/ApplikeySolutions/Grav

Applikey Solutions 2.8k Jan 1, 2023
Lightweight custom collection view inspired by Airbnb.

ASCollectionView Lightweight custom collection view inspired by Airbnb. Screenshots Requirements ASCollectionView Version Minimum iOS Target Swift Ver

Abdullah Selek 364 Nov 24, 2022
CardsLayout is a lightweight Collection Layout.

CardsLayout is a lightweight Collection Layout. Installation CocoaPods

Filipp Fediakov 798 Dec 28, 2022
Easy and type-safe iOS table and collection views in Swift.

Quick Start TL;DR? SimpleSource is a library that lets you populate and update table views and collection views with ease. It gives you fully typed cl

Squarespace 96 Dec 26, 2022
Adding ruby style each iterator to Cocoa/Cocoa touch Swift Array and Range classes, And Int.times{} to Int class

Collection-Each Adding ruby style each iterator to Cocoa/Cocoa touch Swift Array, Dictionary and Range classes, and Int.times ###Why? Array/Dictionary

Omar Abdelhafith 65 Jun 9, 2018
UICollectionViewCell with checkbox when it isSelected and empty circle when not - like Photos.app "Select" mode.

CheckmarkCollectionViewCell UICollectionViewCell with checkbox when it isSelected and empty circle when not - like Photos.app "Select" mode. Usage cla

Yonat Sharon 62 Oct 19, 2022
This component allows for the transfer of data items between collection views through drag and drop

Drag and Drop Collection Views Written for Swift 4.0, it is an implementation of Dragging and Dropping data across multiple UICollectionViews. Try it

Michael Michailidis 508 Dec 19, 2022
UICollectionView and UIStackView Homework

UICollectionView and UIStackView Homework Use one outer StackView containing one CollectionView on top and a horizontal StackView at the bottom with t

null 0 Nov 11, 2021
Gliding Collection is a smooth, flowing, customizable decision for a UICollectionView Swift Controller.

A smooth, flowing, customizable decision for a UICollectionView Swift Controller We specialize in the designing and coding of custo

Ramotion 1.5k Dec 19, 2022
Spreadsheet CollectionViewLayout in Swift. Fully customizable. 🔶

SwiftSpreadsheet Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Swift 5.0 Inst

Wojtek Kordylewski 637 Dec 30, 2022
Made in Swift - Tag layout for UICollectionView supporting 3 types of alignments - Left || Centre || Right

TagCellLayout About Its an ui-collection-view LAYOUT class that takes care of all the logic behind making tags like layout using UICollectionView. It

Ritesh Gupta 346 Jan 1, 2023
A lightweight UICollectionViewLayout that 'pages' and centers its cells 🎡 written in Swift

CenteredCollectionView CenteredCollectionView is a lightweight drop in place UICollectionViewFlowLayout that pages and keeps its cells centered, resul

Ben Emdon 1.2k Dec 6, 2022
Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.

SlideController is a simple and flexible UI component fully written in Swift. Built using power of generic types, it is a nice alternative to UIPageVi

Touchlane 409 Dec 6, 2022
Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.

SlideController is a simple and flexible UI component fully written in Swift. Built using power of generic types, it is a nice alternative to UIPageVi

Touchlane 411 Jan 5, 2023
A UICollectionViewLayout subclass displays its items as rows of items similar to the App Store Feature tab without a nested UITableView/UICollectionView hack.

CollectionViewShelfLayout A UICollectionViewLayout subclass displays its items as rows of items similar to the App Store Feature tab without a nested

Pitiphong Phongpattranont 374 Oct 22, 2022
Get notified about available COVID-19 vaccination appointments in Berlin's vaccination centers

VaccinationMonitor If you live in Berlin you might know how difficult it is to find an appointment to get a COVID-19 vaccination. This app notifies yo

Christian Lobach 8 Jan 14, 2022
Generate help centers for your iOS apps, with Markdown

Generate help centers for your iOS apps, with Markdown! All you need to do is wr

Peter Salz 6 Jan 15, 2022