GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cemolcay/ReorderableGridView-Swift: reorderable grid view solution implemented with swift. its UIScrollView subclass, its not a collection view layout.

BranchesTags
Open more actions menu

Latest commit

 

History

40 Commits
40 Commits

Folders and files

NameName
Last commit message
Last commit date
ReorderableGridView-Swift.xcodeproj
ReorderableGridView-Swift.xcodeproj
 
 
ReorderableGridView-Swift
ReorderableGridView-Swift
 
 
ReorderableGridView-SwiftTests
ReorderableGridView-SwiftTests
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
demo.gif
demo.gif
 
 

Repository files navigation

ReorderableGridView-Swift

reorderable grid view solution implemented with swift.
its UIScrollView subclass, its not a collection view layout.
automatically sets horizontal item spacing by item widths. so items must be fixed-width.
also sets automatically its content size.
if you call gridView?.invalidateLayout() after orientation changed, it will lays out the grid by new orientation.

Demo

alt tag

Usage

copy & paste the ReorderableGridView.swift into your project.

  gridView = ReorderableGridView(frame: self.view.frame, itemWidth: 180, verticalPadding: 20)
  self.view.addSubview(gridView!)

Grid view ready !

now you can add it ReorderableView instances

  let itemView = ReorderableView (x: 0, y: 0, w: 180, h: 250)
  ...
  gridView?.addReorderableView(itemView)
  
  // or
  let pos = GridPosition (x: 0, y: 1)
  gridView?addReorderableView (itemView, gridPosition: pos)

or remove them

gridView?.removeReorderableViewAtGridPosition(GridPosition (x: 0, y: 0))

// or
gridView?.removeReorderableView (itemView)

Design Tip
View itself don't have any margin padding.
It uses all frame width to calculate how many ReorderableViews can fit and what should be their horizontal padding in a row.
Padding between columns (vertical padding) can be set in init method,
which is 10 by default.
You can have a container view and use something like
CGRectInset (containerView.frame, marginX, marginY)
when init grid with margin

Optional Values

  var reorderable : Bool = true
  var draggable : Bool = true
  var draggableDelegate: Draggable?

set them if you want your grid editable or not

Draggable Protocol

func didDragStartedForView (reorderableGridView: ReordableGridView, view: ReordableView)
func didDraggedView (reorderableGridView: ReordableGridView, view: ReordableView)
func didDragEndForView (reorderableGridView: ReordableGridView, view: ReordableView)

set gridView.draggableDelegate = self and implement Draggable protocol functions if you want to access info about dragging actions in grid.
This can be useful for multiple grid layouts.
Example included in second tab of demo.

About

reorderable grid view solution implemented with swift. its UIScrollView subclass, its not a collection view layout.

Resources

Readme
MIT license
Activity

Stars

282 stars

Watchers

18 watching

Forks

27 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.