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
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
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 Jan 6, 2023
An easy-to-use Collection View Layout for card-like animation.

CarLensCollectionViewLayout An easy-to-use Collection View Layout for card-like animation ?? CarLensCollectionViewLayout was created out of the implem

Netguru 530 Dec 16, 2022
Declaretive UICollectionViewCompositionalLayout interface to implement complex collection view layout.

CompositionalLayoutViewController Example To run the example project, clone the repo, and run pod install from the Example directory first. Requiremen

ONEinc 19 Dec 2, 2022
CardsLayout is a lightweight Collection Layout.

CardsLayout is a lightweight Collection Layout. Installation CocoaPods

Filipp Fediakov 798 Dec 28, 2022
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
🔄 GravitySlider is a beautiful alternative to the standard UICollectionView flow layout.

GravitySliderFlowLayout Made by Applikey Solutions Find this project on Dribbble Table of Contents Purpose Supported OS & SDK Versions Installation Us

Applikey Solutions 958 Dec 23, 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
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
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
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
A mirror of Apple's sample code for high performance collection views in iOS 15.

Building High-Performance Lists and Collection Views Improve the performance of lists and collections in your app with prefetching and image preparati

Tim Oliver 14 Nov 12, 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
iOS custom view to display books on shelf

ShelfView (iOS) iOS custom view to display books on shelf (Android version is available here) Requirements iOS 10.0+ Swift 4.2 Installation ShelfView

Adeyinka Adediji 268 Dec 10, 2022
Useful SwiftUI container view's. FittingGeometry, ScrollableView, LayoutReader, PageView, UIKitView. (iOS)

Containers Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ Useful SwiftUI container view's for additional convenience. I

SwiftUI+ 32 Dec 27, 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