GithubHelp home page GithubHelp logo

dipkasyap / rhpreviewcell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robertherdzik/rhpreviewcell

0.0 0.0 0.0 15.21 MB

I envied so much Spotify iOS app this great playlist preview cell 😍, I decided to create my own one 🌢. Now you can give your users ability to quick check "what content is hidden under your UITableViewCell". Great think is that this Library not requires 3D Touch support from user deviceπŸ’₯.

License: MIT License

Ruby 5.83% Objective-C 2.83% Shell 26.94% Swift 64.40%

rhpreviewcell's Introduction

Version License Platform Language

RHPreviewCell 🌢

I envied so much Spotify iOS app this great playlist preview cell 😍, I decided to create my own one 🌢. Now you can give your users ability to quick check "what content is hidden under your UITableViewCell". Great think is that this Library not requires 3D Touch support from user deviceπŸ’₯.

Play with it 😎

Installation

You can install RHPreviewCell library using Cocoapods:

pod 'RHPreviewCell'

or you can simply copy RHPreviewCellSource folder to your project.

Usage

To fully integrate RHPreviewCell with your Table View you just need to use RHPreviewCell like normal UITableViewCell in terms of your TableView data source 'cellForRowAtIndexPath' method.

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    // Fetching already registered RHPreviewTableViewCell
    let cell = tableView.dequeueReusableCellWithIdentifier(reuseCellIdentifier) as! RHPreviewTableViewCell

    // Delegate using which, tiles will talk to your class
    cell.delegate = self
    // Data source for feed small tiles 🚼
    cell.dataSource = self

    return cell
}

πŸ’‘ Important thing is that your View Controller needs to comform to RHPreviewCellDataSource and RHPreviewCellDelegate protocols. In that way you will be able to provide all neccesary data for RHPreviewTalveViewCell tiles.

RHPreviewCellDataSource

func previewCellNumberOfTiles(cell: RHPreviewTableViewCell) -> Int
func previewCell(cell: RHPreviewTableViewCell, tileForIndex: Int) -> RHPreviewTileView

RHPreviewCellDelegate

func previewCell(cell: RHPreviewTableViewCell, didSelectTileAtIndex indexValue: RHTappedTileIndexValue)

And thats it! πŸ’₯ You have already integrete Library with your Table View πŸŽ‰

Implementation hint from me

[Q] How may look like tiles communiacation with my classβ“πŸ€”

As I said using RHPreviewCellDelegate . I will show you how to handle it for particular cell:

func previewCell(cell: RHPreviewTableViewCell, didSelectTileAtIndex indexValue: RHTappedTileIndexValue) {
    let cellIndex = tableView.indexPathForCell(cell)!.row

    switch indexValue {
    case .TileTapped(let index):
        print("😲 \(index) has been selected")
    case .FingerReleased:
        print("πŸ––πŸ½ Finger has been released (non of tiles has been tapped)")
    }
}

... as you can see delegate method as a argument takes RHTappedTileIndexValue , yup... it is swift enum using which you will gather information about tapped tile (.TileTapped(let index) ) or even whether user released his finger out of tiles area (.FingerReleased ).

Swift support

Library ver Swift ver
1.0.1 2.2
1.0.2 2.3
1.0.3 3.0

Check the Demo project

Please check out the demo project, you can see there how Library has been implemented in details.

rhpreviewcell's People

Contributors

robertherdzik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.