BouncyLayout is a collection view layout that makes your cells bounce.

Overview

BouncyLayout is a collection view layout that makes your cells bounce.

Features

  • Pure Swift 5.
  • Works with every UICollectionView.
  • Horizontal and vertical scrolling support.
  • Configurable bounce effect.
  • Supports cell size changes

Setup

The only you thing you need to do is import BouncyLayout, create an instance and add it to your UICollectionView.

import BouncyLayout
let layout = BouncyLayout()
UICollectionView(frame: .zero, collectionViewLayout: layout)
Find the above displayed examples in the example folder.

Installation

CocoaPods

BouncyLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BouncyLayout"

Carthage

BouncyLayout is available through Carthage. To install it, simply add the following line to your Cartfile:

github "roberthein/BouncyLayout"

Swift Package Manager

BouncyLayout is available through Swift Package Manager. To install it, in Xcode 11.0 or later select File > Swift Packages > Add Package Dependency... and add BouncyLayout repository URL:

https://github.com/roberthein/BouncyLayout.git

Suggestions or feedback?

Feel free to create a pull request, open an issue or find me on Twitter.

Comments
  • Pod not working

    Pod not working

    This is my podfile look like

    use_frameworks!
    pod 'BouncyLayout'
    

    when i install my pod it throws error like:

    Analyzing dependencies
    [!] Unable to find a specification for `BouncyLayout`
    
    opened by hilalbaig 20
  • Strange behaviour with grid example

    Strange behaviour with grid example

    Hi, nice layout !

    I have an issue with the example on my iPhone SE and the grid exemple. In random scroll position cell start to make small circle animations on themselves often by group.

    PS : I don't know how to provide you a gif of it I'd be glad to learn :) so you'll get a video bugPhotoCell.mov.zip

    opened by Alex293 7
  • Crash when inserting cell

    Crash when inserting cell

    when the method insertItemsAtIndexPaths: is executed,the program crashes and prints the log: no UICollectionViewLayoutAttributes instance for -layoutAttributesForItemAtIndexPath:

    opened by mokyz-zz 4
  • Overlapping Cells

    Overlapping Cells

    I'm using BouncyLayout horizontally, and find that the spacing between each cell compresses far too much, causing an overlap.

    Is there a way to avoid compression altogether and have the cells kind of bump of against each other?

    opened by BeauNouvelle 3
  • Support for self-sizing cells

    Support for self-sizing cells

    Hi there, good job on this project, it looks really cool and I am looking forward to using it.

    I tried to use it with my collection view in which I’m using self-sizing cells, simply droppping in BouncyLayout() in place of the existing UICollectionViewFlowLayout(), and setting a random .estimatedItemSize before assigning it to the collection view. The self-sizing behaviour doesn’t remain, however, and the cells all get resized to a fixed size.

    My project is currently in a haphazard state so I can’t upload the code; however I’m using IGListKit and was able to reproduce this effect with their provided self-sizing cells example.

    Do you plan on adding support for self-sizing cells to BouncyLayout? The Instagram people themselves had a bunch of issues with implementing it, so I would understand if you don’t plan on doing so; their codebase would be a great help if you did, however.

    Thanks!

    opened by HarshilShah 3
  • Change public class to open class to allow subclassing

    Change public class to open class to allow subclassing

    I'd like to do some initial display animations through override func initialLayoutAttributesForAppearingItem but can't subclass when importing as an external framework (Carthage)

    opened by nik-418 2
  • Optimized oldBehaviors(for:), newBehaviors(for:) and shouldInvalidate…

    Optimized oldBehaviors(for:), newBehaviors(for:) and shouldInvalidate…

    Optimized oldBehaviors(for:), newBehaviors(for:) and shouldInvalidateLayout(forBoundsChange:)

    While chaining multiple map, flatMap and filter calls makes the code very readable, a class that is meant to be used as a library should strive for performance. I have taken the liberty to optimise the aforementioned methods so they don't perform superfluous full passes over collections.

    Also, now shouldInvalidateLayout(forBoundsChange:) returns the result of comparing the current bounds.width with the newBounds.width, so the layout can adapt to interface orientation or size class changes.

    opened by alessandro-martin 2
  • Performance + Detect Size Changes [Fixes: 24, 15, 6]

    Performance + Detect Size Changes [Fixes: 24, 15, 6]

    • Reduced number of iterations required to prepare layout
    • Cache visible indices
    • Cache visible cell CGSizes
    • Update UIDynamicAnimator on cell size change
    • Cleanup private methods and stop leakage of utils
    • Remove redundant layout invalidations
    opened by marcus433 1
  • Self resize cell messages

    Self resize cell messages

    Your lib is so cool :)) I'm making a chat app and i dont know how to make cell message auto dimension (like tableview) with bouncy. Does you lib support or how i can archive that? Thank you!

    opened by nhatquangz 1
  • BouncyLayout for UITableView

    BouncyLayout for UITableView

    Hi @roberthein, I really love BouncyLayout and have used it for a few of my collection views so far which has worked well. However, I have three UITableViews which should stay tableviews due to some autoresizing issues with UICollectionView even a colleague of mine who is quite experienced at coding was not able to solve. Therefore, I was wondering whether there was a way to use this library on a tableview as I couldn't figure one out. Would really appreciate your help! blurtime

    opened by blurtime 1
  • Bugalicious

    Bugalicious

    There are so many things that don't work with this library.

    • UICollectionReusableViews
    • HeaderReferenceSize isn't respected.
    • Bounce animations on simulator are completely off. (most like apple issue. works on device).
    • CollectionViewHeaders just vanish out of thin air
    • CollectionViewHeaders height are adjusted incorrectly on scroll.
    • Imageviews in cells just disappear on touch.

    The list goes on.

    opened by adamdahan 0
  • macOS Support?

    macOS Support?

    I really like this lib, and I want to use it in my chat app. But it is a macOS app, so I want to know, are there any plans on supporting macOS in the future?

    opened by ggoraa 0
  • Changing UITraitCollection causes display glitches

    Changing UITraitCollection causes display glitches

    Hi! Great library :)

    Not sure if this is iPad specific, but when the UITraitCollection is changed (e.g. display is rotated, OR if you adjust the size of the app in SplitView to name a couple of ways), it throws off the UICollectionView and requires you to scroll down and then back up to have it reload those rows.

    IMG_1986 IMG_1987 IMG_1988

    Any advice would be appreciated! 😄

    opened by project-academy 6
  • the collection view reUse will be miss cell when use section header/footer in it.

    the collection view reUse will be miss cell when use section header/footer in it.

    it works good when collectionView has no header or footer. but will missing cell or some other display trouble when I added it a header or footer in each section. wish you answer! thanks.

    opened by pinksunHenry 0
  • Layout does not maintain cell rotation.

    Layout does not maintain cell rotation.

    I have a view that has rotated cells, simulating cards played out. the cells are rotated randomly:

    if rotateCells {
                let randomInt = Int.random(in: -17..<18)
                cell.rotate(degrees: CGFloat(randomInt))        
    }
    

    When adding BouncyLayout - the cells don't maintain their rotation. I believe this is a bug...

    opened by jminutaglio 0
Releases(2.3.1)
  • 2.3.0(Jul 14, 2020)

    • Reduced number of iterations required to prepare layout
    • Cache visible indices
    • Cache visible cell CGSizes
    • Update UIDynamicAnimator on cell size change
    • Cleanup private methods and stop leakage of utils
    • Remove redundant layout invalidations

    Thanks to @marcus433

    Source code(tar.gz)
    Source code(zip)
Owner
Robert-Hein Hooijmans
iOS Developer
Robert-Hein Hooijmans
UICollectionViewSplitLayout makes collection view more responsive.

UICollectionViewSplitLayout makes collection view more responsive. What's this? UICollectionViewSplitLayout is a subclass of UICollectionViewLayout. I

Yahoo! JAPAN 239 Dec 6, 2022
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
A drop-in mosaic collection view layout with a focus on simple customizations.

FMMosaicLayout is a mosiac collection view layout. There are a great number of media-based iOS applications that use UICollectionViewFlowLayout withou

Fluid Media Inc. 591 Dec 14, 2022
A mosaic collection view layout inspired by Lightbox's Algorithm, written in Swift 🔶

TRMosaicLayout A mosaic collection view layout inspired by Lightbox's Algorithm. This is a swift implementation/extension of @fmitech's FMMosaicLayout

Vincent Le 252 Nov 23, 2022
Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.

Description Blueprints is a collection of flow layouts that is meant to make your life easier when working with collection view flow layouts. It comes

Christoffer Winterkvist 982 Dec 7, 2022
A bunch of layouts providing light and seamless experiences in your Collection View

Swinflate Description Swinflate aims to encorporate a set of collection view layouts which provide a better and even more fluid experience in collecti

Vlad Iacob 224 Dec 19, 2022
The waterfall (i.e., Pinterest-like) layout for UICollectionView.

CHTCollectionViewWaterfallLayout CHTCollectionViewWaterfallLayout is a subclass of UICollectionViewLayout, and it trys to imitate UICollectionViewFlow

Nelson 4.4k Dec 24, 2022
AZSafariCollectionViewLayout is replica of safari browser history page layout. very easy to use, IBInspectable are given for easy integration

AZSafariCollectionViewLayout Features iOS Safari history view layout IBDesignAble for properties Few minutes integration Installation CocoaPods CocoaP

Afroz Zaheer 211 Dec 6, 2022
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 3, 2023
Page view controller with bounce effect

BouncyPageViewController Page view controller with bounce effect inspired by motion design by Stan Yakushevish. Quickstart Create a queue of UIViewCon

Bohdan Orlov 843 Oct 17, 2022
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
UICollectionView layout for presenting of the overlapping cells.

StickyCollectionView UICollectionView layout for presenting of the overlapping cells. Objective-C version here Checkout demo Overview Installation Man

Bogdan Matveev 325 Oct 11, 2022
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
Modern-collection-view - Modern collection view for swift

Modern collection view Sample application demonstrating the use of collection vi

Nitanta Adhikari 1 Jan 24, 2022
Blueprints is a collection of flow layouts that is meant to make your life easier when working with collection view flow layouts.

Blueprints is a collection of flow layouts that is meant to make your life easier when working with collection view flow layouts. It comes

Christoffer Winterkvist 982 Dec 7, 2022
Windless makes it easy to implement invisible layout loading view.

Windless Windless makes it easy to implement invisible layout loading view. Contents Requirements Installation Usage Looks Credits Communication Licen

ArLupin 940 Dec 22, 2022
Windless makes it easy to implement invisible layout loading view.

Windless Windless makes it easy to implement invisible layout loading view. Contents Requirements Installation Usage Looks Credits Communication Licen

ArLupin 940 Dec 22, 2022
UICollectionViewSplitLayout makes collection view more responsive.

UICollectionViewSplitLayout makes collection view more responsive. What's this? UICollectionViewSplitLayout is a subclass of UICollectionViewLayout. I

Yahoo! JAPAN 239 Dec 6, 2022
UICollectionViewSplitLayout makes collection view more responsive.

UICollectionViewSplitLayout makes collection view more responsive. What's this? UICollectionViewSplitLayout is a subclass of UICollectionViewLayout. I

Yahoo! JAPAN 239 Dec 6, 2022