VerticalFlowLayout - This implementation is built using a UICollectionView and a custom flowLayout.

Overview

VerticalFlowLayout

This implementation is built using a UICollectionView and a custom flowLayout.

cocoapods version Carthage compatible GitHub platform swift5.0
Replay

Table of contents

Requirements

  • iOS 11.0+
  • Swift 5

Installation

CocoaPods

Add Instructions to your Podfile:

pod 'VerticalFlowLayout'

Then, run the following command:

$ pod install

Swift Package Manager

In Xcode, use File > Swift Packages > Add Package Dependency and use https://github.com/rastaman111/VerticalFlowLayout.

Carthage

To install with Carthage, simply add the following line to your Podfile:

github "rastaman111/VerticalFlowLayout"

Manually

If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/VerticalFlowLayout folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

Usage

To use VerticalFlowLayout inside your UIViewController:

UICollectionViewCell { let cell = verticalCollectionView.dequeueReusableCell(withReuseIdentifier: "ExampleCell", for: indexPath) as! ExampleCell return cell } func numberOfItemsIn(verticalCollectionView: VerticalCollectionView) -> Int { return 20 } func didSelectCell(verticalCollectionView: VerticalCollectionView, indexPath: Int) { // Called when the user clicks on a cell. } }">
import VerticalFlowLayout

class ViewController: UIViewController, VerticalCollectionViewDelegate, VerticalCollectionViewDataSource {
    
    @IBOutlet var verticalView: VerticalView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        verticalView.delegate = self
        verticalView.datasource = self
        
        // register cell
        verticalView.register(nib: UINib(nibName: "ExampleCell", bundle: nil), forCellWithReuseIdentifier: "ExampleCell")
    }
    
    func cellForItemIn(verticalCollectionView: VerticalCollectionView, cellForItemAt indexPath: Int) -> UICollectionViewCell {
        let cell = verticalCollectionView.dequeueReusableCell(withReuseIdentifier: "ExampleCell", for: indexPath) as! ExampleCell
       
        return cell
    }
    
     func numberOfItemsIn(verticalCollectionView: VerticalCollectionView) -> Int {
        return 20
    }
    
    func didSelectCell(verticalCollectionView: VerticalCollectionView, indexPath: Int) {
        // Called when the user clicks on a cell.
    }
}

Additionally

Get current cell

The currently focussed cell index

verticalView.focussedCellIndex

Get a cell at a specified index

Returns the visible cell object at the specified index.

verticalView.cellForItem(at index: Int) -> UICollectionViewCell?

Scroll to a specifc cell

Scrolls the collection view contents until the specified item is visible

verticalView.scrollToCell(at: Int, animated: Bool) -> Bool

Moving cell

Moves an item from one location to another in the collection view.

verticalView.moveCell(at: Int, to: Int)

Deleting cells

Deletes cells at the specified indexes

verticalView.deleteCells(at: [Int])

Inserting cells

Inserts new cells at the specified indexes

verticalView.insertCells(at: [Int])

License

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

Donation

Buy Me A Coffee

You might also like...
SwiftUI Grid layout with custom styles
SwiftUI Grid layout with custom styles

SwiftUI Grid SwiftUI Grid view layout with custom styles. Features ZStack based layout Vertical and horizontal scrolling Supports all apple platforms

Auto Layout made easy with the Custom Layout.
Auto Layout made easy with the Custom Layout.

Auto Layout made easy with the Custom Layout. Getting started CocoaPods CocoaPods is a dependency manager for Cocoa projects. You can install it with

HBFloatingView - A lightweight custom floating view

HBFloatingView Example To run the example project, clone the repo, and run pod i

Easy to create & custom segmented view
Easy to create & custom segmented view

TCSegmentedView Easy to create & custom segmented view Usage Examples An Objective-C example project demonstrating customization options is included i

A Custom ImagePicker Code with SwiftUI.
A Custom ImagePicker Code with SwiftUI.

YYImagePicker A Custom ImagePicker Code with SwiftUI. Author Thanks for Kavsoft!!! 😁 ScreenShot Usage VStack { } .popupImagePickerView(show: $showIm

An experiment creating a particle emitter using the new TimelineView and Canvas views in SwiftUI
An experiment creating a particle emitter using the new TimelineView and Canvas views in SwiftUI

Particle Emitter An experiment creating a particle emitter using the new Timelin

A simple game application using SpriteKit, physics, blend modes, radians and CGFloat
A simple game application using SpriteKit, physics, blend modes, radians and CGFloat

Pachinko A simple game application using SpriteKit, physics, blend modes, radian

How to build and sign your iOS application using Azure DevOps

How to build and sign your iOS application using Azure DevOps Sample source code

This is a simple chat application made in Swift using send and receive interface.

Flash Chat 💁🏽‍♂️ Overview This is a simple chat application made in Swift using send and receive interface. ⚙️ How it works The user needs to first

Releases(1.0)
Owner
Alexander Sibirtsev
iOS Developer
Alexander Sibirtsev
Pintrest flow layout UICollectionView

pintrest-flow-layout Pintrest flow layout UICollectionView You need to adjust the coulmns number you need after setting the layout var layout

Anas Almomany 11 Nov 8, 2022
StoryboardUsingCustomViews - Storyboard Using Custom Views

Storyboard Using Custom Views Vista creada con: Storyboard + Constraints + Progr

Vanesa Giselle Korbenfeld 0 Jan 19, 2022
Fancy Swift implementation of the Visual Format Language (experimental and doesn't work with the recent version of Swift)

VFLToolbox Autolayout is awesome! VFL a.k.a Visual Format Language is even more awesome because it allows you to shorten constraints setting code. The

0xc010d 144 Jun 29, 2022
FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax.

FlexLayout adds a nice Swift interface to the highly optimized Yoga flexbox implementation. Concise, intuitive & chainable syntax. Flexbox is an incre

layoutBox 1.7k Dec 30, 2022
sample project for `UICollectionViewLayout` implementation

collection-view-layout-pattern-sample UICollectionViewLayout implementation pattern. About This project is introduced in iOSDC Japan 2021. sample code

Toshiki Takezawa 13 Nov 3, 2021
ios-queryable is an implementation of IQueryable/IEnumerable for Core Data

#ios-queryable is an Objective-C category that provides IQueryable and IEnumerable-like functionality to Core Data. Tired of writing boilerplate Core

Marty Dill 227 Mar 3, 2022
Boardy - Boardy serves as a digital bulletin board on iOS platforms built for high schoolers to share and view information from others in a convenient manner.

Boardy Boardy serves as a lightweight digital bulletin board on iOS platforms built for high schoolers to share and view information from others in a

Jacky Luong 0 Dec 31, 2021
Customise sheets on iOS, bottom sheets, custom detents and more..

Sheetster A custom sheet creator library for iOS Devices Features Extends UISheetPresentationController Objective C Private API Custom Detent Setter G

Admir Šaheta 3 Nov 27, 2022
Declarative iOS UI sugar framework built on FlexLayout

Declarative iOS UI sugar framework built on FlexLayout

당근마켓 97 Dec 9, 2022
Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button to button when the user presses on them.

Swift-Underlined-Button-Bar Custom UIView class that hosts an array of UIbuttons that have an 'underline' UIView beneath them which moves from button

Justin Cook 3 Aug 4, 2022