Code Monkey home page Code Monkey logo

feelings's Introduction

Feelings ๐ŸŽญ

Another rating view to share your feelings.

Build Status License Platform Swift 3.x MadeWithLove Awesome-Swift

Installation

IMPORTANT: You will need two images, one is filled and another is unfilled to represents feelings. See this sample images for the same, check it here.

1.Manually - Add FeelingsView.swift class to your Project. All set.

2.CocoaPods: pod 'FeelingsView'

Usage:

Create Programmatically.

//Create Sample Arrays
let rows = ["Quality","Price","Value"]
let columns = ["1 Star","2 Star","3 Star","4 Star","5 Star"]
        
//Create FeelingsView
//Note: You should provide two images for FeelingsView. 1. Filled and 2. Unfilled        
let viewFeeling = FeelingsView.init(frame: CGRect.init(x: 0.0, y: 0.0, width: 300.0, height: 200.0))
viewFeeling.backgroundColor = UIColor.clear
viewFeeling.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin, .flexibleBottomMargin]
self.view.addSubview(viewFeeling)
viewFeeling.center = self.view.center
    
//Setting fill/unfill images for FeelingsView
viewFeeling.fillImage = UIImage.init(named: "filled.png")!
viewFeeling.unfillImage = UIImage.init(named: "unfilled.png")!
        
//Setting up values for Feelings
viewFeeling.columnTitles = columns
viewFeeling.rowTitles = rows 
    
//Reload
viewFeeling.reloadFeelingView()
        
//Detect selection of Feelings value
viewFeeling.onFilledCompletion = { (row,column) in
    //Note: row and column are the Int which a user tapped in the FeelingsView
    let rowValue = rows[row]
    let columnValue = columns[column]
    print("\(rowValue) -> \(columnValue)")
}

IMPORTANT: For customizations see the example.

Create in Storyboard/XIB.

  1. Add a UIView. Set require size. Add constraints if requires.

  2. Change class type from UIView to FeelingsView.

  1. Apply the properties for FeelingsView.

  1. Create an IBOutlet for FeelingsView. Bind it in IBInspector.

  2. In viewDidLoad or at anyplace where you want provide rows and columns titles.

  3. Reload FeelingsView by calling reloadFeelingView function.

  4. Detect the taps on FeelingsView by implementing onFilledCompletion closure block.

ToDo[s]

  • CocoaPods support

You can watch to Feelings to see continuous updates. Stay tuned.

Have an idea for improvements of this class? Please open an issue. ย  ย 

Credits

Hemang Shah

You can shoot me an email to contact.

License

The MIT License (MIT)

Read the LICENSE file for details.

feelings's People

Contributors

bdwolfe avatar hemangshah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

feelings's Issues

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.