Whole, half or floating point ratings control written in Swift

Overview

FloatRatingView

A simple rating view for iOS written in Swift! Supports whole, half or floating point values. I couldn't find anything that easily set floating point ratings, so I made this control based on a Ray Wenderlich tutorial. Some of the best iOS tutorials that I've come across.

Check out the post on medium for a full write-up.
https://medium.com/@glenyi/float-rating-view-in-swift-e740b6b9404d

FloatRatingView Demo

Usage

Initialize from a nib/xib or programmatically. Set the empty and full image, then you're pretty much good to go! Check out the demo app to see how it can be used.

Release v4.0 is updated for Swift 5.0 while v1.0.3 is on Swift 2.3.

Usage in an Objective-C Project

  1. Import the Swift File
  2. Ensure the build settings in your project are set to enable Swift usage (see here and here)
  3. import "YOUR_PROJECT_NAME-Swift.h" in your Objective-C files where you want to use FloatRatingView

Pod Installation

For Swift 2.3 projects just add the following to your podfile:

pod 'FloatRatingView', '~> 1.0.3'

For Swift 5.0 projects:

pod 'FloatRatingView', '~> 4'

How it works

The concept is a little different from the source tutorial. The float rating view lays the full image views on top of the empty image views then sets the CALayer mask property to partially hide full images. The full image view mask frame is calculated whenever needed for half or floating point values.

Comments
  • Submit Podspec to trunk

    Submit Podspec to trunk

    It'd be easier to people find out about (and use) FloatRatingView if the Podspec was pushed to CocoaPods Spec repo.

    More info: https://guides.cocoapods.org/making/getting-setup-with-trunk.html

    opened by marcelofabri 3
  • ... not key value coding-compliant for the key ...

    ... not key value coding-compliant for the key ...

    I am getting a bunch of warnings of the following type:

    Ignoring user defined runtime attribute for key path [variable name] of instance of UIView. Hit an exception when attempting to set its value ...setValue:forUndefinedKey: this class is not key value coding compliant for the key [variable name]

    I see this for editable, emptyImage, floatRatings, fullImage, halfRatings and so on.

    I have inserted a view controller to storyboard which has a view with custom class FloatRatingView.

    I believe that I started to see it after changing the deployment target to iOS7. I have already searched the web, but I did not find a fast solution. I am happy to help if I understand the issue.

    opened by sebbu 3
  • Added new Optional property `ibDelegate` of type `AnyObject` which se…

    Added new Optional property `ibDelegate` of type `AnyObject` which se…

    …rves as a workaround and addresses the fact that IB cannot reference protocol outlets in Swift files (still the case in Xcode 8.0). This property can be used to set the delegate of the view in a storyboard. See http://bit.ly/2eLvVoq for details.

    Made the delegate property an @IBOutlet. The example app sets the rating view delegate from the storyboard. Opened the storyboard of the example project in Xcode 8.0 and fixed resulting misplacements.

    opened by raginmari 2
  • Rendering issue

    Rendering issue

    I just got this error whenever i am enter in storyboard...after some time it disappears...but it gives slow performance error...how to get rid of this

        error: IB Designables: Failed to render instance of FloatRatingView: Rendering the view took longer than 200 ms. Your drawing code may suffer from slow performance.
    
    opened by BhavinBhadani 2
  • Version 4.0 released

    Version 4.0 released

    Version 4.0 🆕

    I've updated current project and forked to a new repository, because that repository is not maintained anymore 🙁 (great work, glenyi, thank you for creating that project).

    New version is located here: https://github.com/Sorix/RatingControl.

    Changelog

    UIControl

    FloatingRatingView renamed to RatingControl. Also now it is a subclass of UIControl instead of UIView, because that RatingView is closer to control type than view type.

    Now control supports default UIControl methods, like isEnabled, addAction, @IBAction outlets and so on. Please use it instead of delegate methods, because it's a more native way.

    Storyboard

    You can add storyboard's @IBAction outlets in Interface Builder without writing a code for delegate methods. Less code for you.

    Also I've added support for intrinsicContentSize, so view know about own's desired size (like labels or buttons) and you will need to define less constraints and it will be easier to configure it in Interface Builder.

    Haptic

    Support of haptic feedback was added, try that magic on devices with appropriate hardware.

    Compatibility

    RatingControl (4.0) is almost compatible with previous version of FloatingRatingView.

    1. You need to find and replace import statements because of library renaming:
    import FloatingRatingView // search that
    import RatingControl // replace to that
    
    1. Minimum required iOS version now is 10.0.

    Because of that 2 breaking changes, version was changed to 4.0.

    RatingControl is now a subclass of UIControl that's why a lot of old methods was deprecated, you still can use it. XCode will warn you about outdated methods with help messages with fix proposals.

    Other changes

    • Support Swift 4.2
    • Objective-C support
    • Update Example application
    • Tidy folder structure
    opened by Sorix 1
  • Adds Carthage support

    Adds Carthage support

    As mentioned in #15 I've added Carthage support. The process is fairly straightforward, you really only need a project with a configured scheme. I've tested and verified that it works by integrating it into a test project using github "VFUC/FloatRatingView" "carthage" in the Cartfile

    If you're interested, I'd be happy to add the Carthage compatible flag to the README as well, let me know if and where you'd prefer it. 🙂

    opened by VFUC 1
  • Not support in Swift 3.0

    Not support in Swift 3.0

    Hello ,

    I have tried to implement in my application which is in Swift 3.0 but unfortunately this is not work in my app. It gives me error like this "FloatRatingView is not a member class of FloatRatingView"

    Thanks.

    opened by Birju-Bhatt 1
  • Added tint to rating images, vertical / bottom-up rating orientation …

    Added tint to rating images, vertical / bottom-up rating orientation …

    …and updated demo layout

    Rating images are tinted based on parent FloatRatingView tintColor, added vertical orientation option for rating and updated constraints in storyboard.

    Additional changes to demo to reflect above changes with switch in view controller to enable and disable vertical orientation.

    opened by reedand 1
  • FloatRatingView not wroking properly when we add it on tableview cell

    FloatRatingView not wroking properly when we add it on tableview cell

    Hi, when i add it on Tableview cell then it not working as expected . i mean when we try to tap on any star it doesn't change the star values only working on floating .

    opened by Sahilberi 1
  • ISSUE With swift 1.2

    ISSUE With swift 1.2

    I have some issues with the interface builder. So XCODE tells me : /Main.storyboard: warning: IB Designables: Ignoring user defined runtime attribute for key path "rating" on instance of "UIView". Hit an exception when attempting to set its value: [<UIView 0x7fc0b9cab4d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key rating.

    opened by BilalReffas 1
  • Add tvOS to the podspec?

    Add tvOS to the podspec?

    I'm trying to fix up PopcornTimeTV/PopcornTimeTV, and apparently they've been using this pod in the tvOS target in the past. Not sure how since it appears your podpsec never declared it supported tvOS. It looks like they just created their own spec and manually added tvOS to the spec.

    This leads me to believe it actually works on tvOS. Could you add tvOS to the list of supported platforms, like the spec file linked above does? Worst case, it doesn't work and you can remove it. Best case, it does, and I'll let you know!

    opened by NSExceptional 0
  • No suitable image found

    No suitable image found

    Hi everybody.

    I have an error when I tried to start my app in an Iphone 7 plus with IOS 13.3.1, but in an others Iphone with a IOS oldest it is working fine, it is the error that I have obtain:

    dyld: Library not loaded: @rpath/FloatRatingView.framework/FloatRatingView Referenced from: /private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Kafuu Reason: no suitable image found. Did find: /private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView: code signature invalid for '/private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView'

    /private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView: code signature invalid for '/private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView'
    
    /private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView: stat() failed with errno=1
    /private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView: code signature invalid for '/private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView'
    
    /private/var/containers/Bundle/Application/C1FE3C2D-55F9-4A68-B182-26C43EDA4B98/Kafuu.app/Frameworks/FloatRatingView.framework/FloatRatingView: stat() failed with errno=1
    

    (lldb)

    Regards

    opened by kzp01 1
  • No shared framework scheme for Carthage

    No shared framework scheme for Carthage

    When trying to do a carthage update, receiving the following error:

    Dependency "FloatRatingView" has no shared framework schemes for any of the platforms: iOS

    opened by droobah 0
Releases(4.0)
A star rating control for iOS/tvOS written in Swift

Cosmos, a star rating control for iOS and tvOS This is a UI control for iOS and tvOS written in Swift. It shows a star rating and takes rating input f

Evgenii Neumerzhitckii 2.1k Dec 28, 2022
Simple star rating view for iOS written in Objective-C

HCSStarRatingView HCSStarRatingView is a UIControl subclass to easily provide users with a basic star rating interface. It supports all device resolut

Hugo Sousa 1.3k Dec 21, 2022
Whole, half or floating point ratings control written in Swift

FloatRatingView A simple rating view for iOS written in Swift! Supports whole, half or floating point values. I couldn't find anything that easily set

Glen Yi 546 Dec 8, 2022
Floating-textfield-swiftui - Floating textfield swiftui: Floating field with multiple icons

floating_textfield-swiftui Hey, Guys welcome to this tutorial. In this complete

Patrick 0 Jan 2, 2022
RCalendarPicker A date picker control, Calendar calendar control, select control, calendar, date selection, the clock selection control.

RCalendarPicker RCalendarPicker Calendar calendar control, select control, calendar, date selection, the clock selection control. 日历控件 ,日历选择控件,日历,日期选择

杜耀辉 131 Jul 18, 2022
Approximate is a Swift package that provides implementations of floating point comparisons for the Swift ecosystem

Approximate Approximate floating point equality comparisons for the Swift Programming Language. Introduction Approximate is a Swift package that provi

Christopher Blanchard 1 Jun 1, 2022
Floating-textfield-swiftui - Floating textfield With SwiftUI

floating_textfield-swiftui Hey, Guys welcome to this tutorial. In this complete

null 1 Feb 11, 2022
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!

ver 2.0 NB! Breaking changes in 2.0 - due to a lot of requests EasyAnimation does NOT automatically install itself when imported. You need to enable i

Marin Todorov 3k Dec 27, 2022
Bond is a Swift binding framework that takes binding concepts to a whole new level.

Bond, Swift Bond Update: Bond 7 has been released! Check out the migration guide to learn more about the update. Bond is a Swift binding framework tha

Declarative Hub 4.2k Jan 5, 2023
Custom Label to apply animations on whole text or letters.

Ophiuchus Custom Label to apply animations on whole text or letters. Check an article on our blog Inspired by this project on Dribble Installation Coc

Yalantis 885 Dec 2, 2022
StarryStars is iOS GUI library for displaying and editing ratings

StarryStars StarryStars is iOS GUI library for displaying and editing ratings Features StarryStars' RatingView is both IBDesignable and IBInspectable

Peter Prokop 175 Nov 19, 2022
StarryStars is iOS GUI library for displaying and editing ratings

StarryStars StarryStars is iOS GUI library for displaying and editing ratings Features StarryStars' RatingView is both IBDesignable and IBInspectable

Peter Prokop 175 Nov 19, 2022
iOS App to display game lists and details with the ability to add games to your favorites list and see metacritic ratings.

Game Data System - GDS Author: Heitor Silveira ([email protected]) iOS App to view games from various platforms, their description, release

Heitor Ugarte Calvet da Silveira 0 Oct 6, 2021
The purpose of this app is to list all of the schools in New Jersey and assign ratings to chosen schools.

My First iOS App Introduction This is my first iOS App from my CSSE337 Enterprise Mobile Apps class for college. Here was the objective of the assignm

null 0 Dec 27, 2021
iOS simple project to create half-screen modal view controller with pan

Simple Half-screen view controller, draggable and less code (learning purpose)

Mohd Hafiz 123 Dec 17, 2022
Simple way to set up half modal view

HalfModalView Requirements iOS 9.0+ Xcode 10.0+ Swift 4.0+ Example Installation CocoaPods is a dependency manager for Cocoa projects. You can install

Choi SeungMyeong 5 Nov 14, 2022
Half modal view for SwiftUI

ResizableSheet ResizableSheeet is a half modal view library for SwiftUI. You can easily implement a half modal view. Target Swift5.5 iOS14+ Installati

matsuji 76 Dec 16, 2022
SwiftUI package to present a Bottom Sheet interactable view with the desired Detents. Also known as Half sheet.

BottomSheetSUI BottomSheetSUI is a package that gives you the ability to show a Bottom sheet intractable, where you can add your own SwiftUI view. You

Aitor Pagán 8 Nov 28, 2022
UIViewController extension to present view / view controller as bottom-half modal.

UIViewController extension to present view / view controller as bottom-half modal. Installation CocoaPods pod 'SemiModalViewController' Swift Package

Winter 78 Mar 3, 2022
SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.

SSToastMessage SSToastMessage is written in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to b

Simform Solutions 223 Dec 2, 2022