A component to quickly scroll between collection view sections

Overview

SectionScrubber

Version Carthage compatible platforms License

  • The scrubber will move along when scrolling the UICollectionView it has been added to.
  • When you pan the scrubber you 'scrub' over the UICollectionView.
  • While scrubbing you can choose the title that will be shown in the scrubber.

Usage

From your UICollectionViewController:

lazy var sectionScrubber: SectionScrubber = {
    let scrubber = SectionScrubber(collectionView: self.collectionView)
    scrubber.sectionlabelTextColor = UIColor(red: 69/255, green: 67/255, blue: 76/255, alpha: 0.8)
    scrubber.dataSource = self

    return scrubber
}()

override func viewDidLoad() {
    super.viewDidLoad()
    self.collectionView?.addSubview(sectionScrubber)
}

override func scrollViewDidScroll(scrollView: UIScrollView) {
    self.sectionScrubber.updateScrubberPosition()
}

override func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
    self.sectionScrubber.updateScrubberPosition()
}

extension RemoteCollectionController: SectionScrubberDataSource {
    func sectionScrubber(sectionScrubber: SectionScrubber, titleForSectionAt indexPath: NSIndexPath) -> String {
        return Photo.title(index: indexPath.section)
    }
}

Installation

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

pod 'SectionScrubber'

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

github "bakkenbaeck/SectionScrubber"

License

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

Author

Bakken & Bæck, @bakkenbaeck

Comments
  • Fix: scrubber

    Fix: scrubber

    Fixes a few issues with the scrubber calculating it's position. This works with all combinations of hidden or shown status bar, navigation bar, tab bar, and so on.

    opened by 3lvis 12
  • Account for section headers when updating section title

    Account for section headers when updating section title

    This updates the title much sooner, as soon as we hit the section header, instead of waiting until we hit the first item row. So far it seems to work fine and avoid the misnamed section issue for the scrubber.

    Doing more testing and checking the code some more. Feedback is always appreciated before merging.

    opened by elland 8
  • Support Swift 2.3

    Support Swift 2.3

    Issues here

        /**
         Initial dragging doesn't take in account collection view headers, just cells, so before the scrubber reaches
         a cell, this is not going to return an index path.
         **/
        private func indexPath(at point: CGPoint) -> NSIndexPath? {
            guard let collectionView = self.collectionView else { return nil }
            if let indexPath = collectionView.indexPathForItemAtPoint(point) {
                return indexPath
            }
            for indexPath in collectionView.indexPathsForVisibleSupplementaryElementsOfKind(UICollectionElementKindSectionHeader) {
                let view = collectionView.supplementaryViewForElementKind(UICollectionElementKindSectionHeader, atIndexPath: indexPath)
                if view!.frame.contains(point) {
                    return indexPath
                }
            }
            return nil
        }
    
    opened by 3lvis 5
  • Improve: tweak sample project

    Improve: tweak sample project

    • Increases amount of sections
    • Increases the height of the section headers and centers their labels
    • Remove local photos related code
    • Refactors titleForSection to have a more Swift 3 kind of API
    • Remove additional newlines to make code formatting more consistent
    • Remove attribution header from UILabel extension

    d

    opened by 3lvis 4
  • Create and drag the View

    Create and drag the View

    Just a small pull request to check if I'm going in the right direction.

    Mostly wandering as to what things should be generically specified in the DateScrubber and what things should be customizable in the client.

    Let me know what you think, in the meantime I continue with moving the collectionview according to the DateScrubber position.

    opened by marijnschilling 4
  • Hiding the sectionLabel after delay is not performed while scrolling the collectionView

    Hiding the sectionLabel after delay is not performed while scrolling the collectionView

    To reproduce:

    1. Use the dateScrubber to scrub over the collectionView so the sectionLabel appears
    2. Release the date scrubber
    3. Scroll the collectionView
    4. The sectionLabel stays visible while scrolling the collectionView, while it should disappear 3 seconds after releasing the dateScrubber
    bug 
    opened by marijnschilling 3
  • Animate the date scrubber and the section label when inactive

    Animate the date scrubber and the section label when inactive

    The scrubber appears and moves along when scrolling through the collection view, and disappears when there's no interaction for 3 seconds.

    The sectionLabel fades in and moves a bit to the left when the scrubber is pressed to "scrub" through the collection view. When the scrubber is released the label moves back to the right. And fades out after 3 seconds.

    alt tag

    • There is one bug where I hide the sectionlabel after a 3 second delay (with performSelector: withObject: afterDelay:) But when I scroll the collectionView during that time, it only hides it after I stop that 🤔
    • So scrolling the collectionview activates the scrubber and using a gesture on the scrubber activates the section label. I implemented some logic to keep track of when to hide and show them, but I'm wondering if I could be more clear. It can be a bit confusing now. Any tips are welcome!
    opened by marijnschilling 3
  • Update section title when scrolling to top and bottom

    Update section title when scrolling to top and bottom

    The sectionScrubber itself can recognise when the scrubber has scrolled to the top of the bottom, but only the collectionViewController itself knows what title's should be displayed in this case.

    I used the datasoure to request the titles, but any suggestion on solving this more elegantly is welcome!

    opened by marijnschilling 2
  • Add SectionScrubberDelegate implementation

    Add SectionScrubberDelegate implementation

    Explain the functionality of the SectionScrubberDelegate. Not sure how to point out that all the methods are optional in the best way :v:

    Also have trouble showing the gif all of a sudden, it was working before but not anymore! Anyone has a clue as to why this might be?

    opened by marijnschilling 2
  • Feature/overlay

    Feature/overlay

    • Show an overlay when the section scrubber is being scrubbed
    • Change the time for hiding the element to 2 seconds
    • fix some small bugs/add some safety state checks for hiding the elements
    • try to fix bug where the section scrubber doesn't go all the way to the bottom [WIP]
    opened by marijnschilling 2
Releases(1.1.1)
Owner
Elvis
Elvis
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
Custom transition between two collection view layouts

Display Switcher We designed a UI that allows users to switch between list and grid views on the fly and choose the most convenient display type. List

Yalantis 2.3k Dec 14, 2022
Parallax Scroll-Jacking Effects Engine for iOS / tvOS

Parade Introduction Communicating to cells inside of UICollectionViews, UITableViews, or UIScrollViews, has always been a challenge. It almost always

Elephant 768 Dec 17, 2022
A SwiftUI collection view with support for custom layouts, preloading, and more.

ASCollectionView A SwiftUI implementation of UICollectionView & UITableView. Here's some of its useful features: supports preloading and onAppear/onDi

Apptek Studios 1.3k Dec 24, 2022
Generic collection view controller with external data processing

FlexibleCollectionViewController Swift library of generic collection view controller with external data processing of functionality, like determine ce

Dmytro Pylypenko 3 Jul 16, 2018
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
A custom paging behavior that peeks the previous and next items in a collection view

MSPeekCollectionViewDelegateImplementation Version 3.0.0 is here! ?? The peeking logic is now done using a custom UICollectionViewLayout which makes i

Maher Santina 353 Dec 16, 2022
🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

A declarative library for building component-based user interfaces in UITableView and UICollectionView. Declarative Component-Based Non-Destructive Pr

Ryo Aoyama 1.2k Jan 5, 2023
Dwifft is a small Swift library that tells you what the "diff" is between two collections

Dwifft! In 10 seconds Dwifft is a small Swift library that tells you what the "diff" is between two collections, namely, the series of "edit operation

Jack Flintermann 1.8k Dec 12, 2022
TLIndexPathTools is a small set of classes that can greatly simplify your table and collection views.

TLIndexPathTools TLIndexPathTools is a small set of classes that can greatly simplify your table and collection views. Here are some of the awesome th

SwiftKick Mobile 347 Sep 21, 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
Modern Collection Views

The goal is to showcase different compositional layouts and how to achieve them. Feel free to use any code you can find and if you have interesting layout idea - open PR!

Filip Němeček 536 Dec 28, 2022
Swift library to support collapsible sections in a table view.

CollapsibleTableSectionViewController A Swift library that helps you collapse table view sections. Features Support collapsible sections in a table vi

Su 349 Dec 18, 2022
A scroll view with a sticky header which shrinks as you scroll. Written with SwiftUI.

Scaling Header Scroll View A scroll view with a sticky header which shrinks as you scroll. Written with SwiftUI. We are a development agency building

Exyte 395 Dec 31, 2022
Collapse and expand UICollectionView sections with one method call.

This library provides a custom UICollectionView that allows to expand and collapse sections. Provides a simple API to manage collection view appearanc

Touchlane 172 Dec 26, 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
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
A swift package(SPM) with iOS UI component that loads and displays images from remote urls or local assets and displays in a slide-show form with auto scroll feature.

MDBannersView A swift package with an iOS UI component that loads and displays images from remote urls, local assets and displays in a slide-show form

Madhav Deva 2 Feb 5, 2022
A scroll pager that displays a list of tabs (segments) and manages paging between given views

ScrollPager A scroll pager similar to the one in Flipboard. The control creates a tabbar given a title or an image, and has the option of connecting t

Aryan Ghassemi 512 Aug 31, 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