Giter Site home page Giter Site logo

tipbadgemanager's Introduction

TIPBadgeManager

alt text

Use TIPBadgeManager with a single badge or easily manange all badges across your application. Cocoa Touch only has built in support for the application icon badge and UITabBarItems. With TIPBadgeManager you can easily add badges to any object that inherits from UIView!

Installation

CocoaPods

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

 $ gem install cocoapods

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

 source 'https://github.com/CocoaPods/Specs.git'
 platform :ios, '8.0'
 use_frameworks!

 pod 'TIPBadgeManager', '~> 0.3.0'

Then, run the following command:

$ pod install

Carthage

Install Carthage - (read instructions at - https://github.com/Carthage/Carthage)

Create a Cartfile and insert the following:

 github "johncosch/TIPBadgeManager" 

Then, run the following command:

 carthage update

On your application targets’ “General” settings tab, in the “Embedded Binaries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

Getting Started

Adding Badges

  var view : UIView = UIView()
  var badgeVal : Int = 1
  TIPBadgeManager.sharedInstance.addBadgeSuperview("someViewName", view: view)
  TIPBadgeManager.sharedInstance.setBadgeValue("someViewName", value: badgeVal)

First add the view you wish to append a badge to with addBadgeSuperview. The first paramater is just a string of your choosing which will be used to reference the badge object. The second parameter is the view itself. Although the second paramater is named "view" it also will accept a UITabBarItem. To actually get the view to show up you must set its value to a positive Int with setBadgeValue. The first parameter is the same referencing string as used in addBadgeSuperview and the second is the value to be set.

Removing Badges

  TIPBadgeManager.sharedInstance.setBadgeValue("someViewName", value: 0)

Like the application icon badge, you remove badges from their superview by setting the value to 0.

Setting All Badges To The Same Value

 TIPBadgeManager.sharedInstance.setAllBadgeValues(5, appIconBadge: true)

The second parameter determines whether the app icon's badge is also set to the value specified.

License

TIPBadgeManager is released under the MIT license. See LICENSE for details.

tipbadgemanager's People

Contributors

johncosch avatar

Watchers

Abdul Samad 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.