/BubbleRankingIndicator

iOS circular level ranking indicator view written in Swift.

Primary LanguageSwiftMIT LicenseMIT

Bubble Ranking Indicator Logo

Swift5 Platform Version License

Description

BubbleRankingIndicator is a customizable circular ranking indicator written in Swift that can be used to display ranking information.

Example

In this screenshot the user has achieved rank 2 out of 4, and the images used are the faces cards of a standard deck of cards.

Contents

  1. Features
  2. Installation
  3. Supported OS & SDK versions
  4. Usage
  5. License
  6. Contact

Features

  • Supports AutoLayout.
  • Supports any number of ranks as long as they fit within the bounds of the view.
  • Supports customizing background images of all ranks.
  • Supports being created either in code or a Storyboard.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate BubbleRankingIndicator into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'BubbleRankingIndicator'

Then, run the following command:

$ pod install

In case Xcode complains ("Cannot load underlying module for BubbleRankingIndicator") go to Product and choose Clean (or simply press K).

Manually

If you prefer not to use CocoaPods, you can integrate BubbleRankingIndicator into your project manually.

  • Supported build target - iOS 11.0+ (Xcode 10+)

BubbleRankingIndicator is state based. To configure the view, simply update the state value with whatever values you'd like, and re-set the state:

  1. First you should set up the BubbleRankingIndicator:
var bubbleRankingIndicatorView = BubbleRankingIndicatorView()

var state = bubbleRankingIndicatorView.state
var ranks = [Rank]()
// Create and initialize all of the Ranks. These can be changed later.
state.ranks = ranks
state.unachievedRankBackgroundColor = .lightGray
state.rankNameFont = .systemFont(ofSize: 30)

bubbleRankingIndicatorView.state = state
  1. In order to set the active rank, modify the state object:
var state = bubbleRankingIndicatorView.state
state.activeRankLevel = 2
bubbleRankingIndicatorView.state = state

BubbleRankingIndicator is developed by Josh Sklar at StockX and is released under the MIT license. See the LICENSE file for details.

You can follow or drop me a line on my Twitter account. If you find any issues on the project, you can open a ticket. Pull requests are also welcome.