Latest 0.1.2
Homepage https://github.com/gwangpa/Badgeable
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Badgeable

Bedgeable is a protocol can display badge into your any custom UI components or even apply all UIView.

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

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

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target '<Your Target Name>' do
    pod 'Badgeable'
end

Then, run the following command:

$ pod install

Carthage

Will support Carthage soon.

Manually

If you prefer to install manually.

  • Clone Badgeable
  • Copy Badgeable.swift file into your Xcode project.
  • That’s it!

Usage

Add import syntax where you would conform Badgeable protocol.

import Badgeable

Conform Badgeable protocol where you want to display badge.

// Conform Badgeable protocol in your class.
class YourButton: UIButton, Badgeable {
    // ...
}

Then you can display badge by setting badgeCount property.

class YourViewController: UIViewController {
    @IBOutlet weak var button: YourButton!
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        button.badgeCount = 6
    }
}

You can conform Badgeable protocol even UIView by extension.

// Conformance Badgeable into UIView
extension UIView: Badgeable {}

Then all UI components can display badge by setting badgeCount property.

TODO

  • Configurable badge appearance.
  • Adjustable badge position. For example: TopLeft, TopRight, BottomLeft and BottomRight.
  • Animatable.

Author

Daniel (Dae Hyun) KIM, [email protected]

License

Badgeable is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Badgeable",
    "version": "0.1.2",
    "summary": "Everything can display badge.",
    "description": "Badgeable can display badge icon any UIView and UIBarButtonItem.nIt is a protocol with default implementation written in Swift 3.0.nJust conforms Badgeable protocol and assign 'badgeCount' property. That's it.",
    "homepage": "https://github.com/gwangpa/Badgeable",
    "screenshots": "https://github.com/gwangpa/Badgeable/blob/master/Screenshots/screenshot-001.png?raw=true",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Daniel KIM": "[email protected]"
    },
    "source": {
        "git": "https://github.com/gwangpa/Badgeable.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Badgeable/Classes/**/*",
    "resource_bundles": {
        "Badgeable": "Badgeable/Assets/*.{json}"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This