Giter VIP home page Giter VIP logo

bedgenotifichub's Introduction

BedgeNotificHub

CI Status Version License Platform

Blink Bump Pop Custom setCircle showCount mix hideCount

Demo/Example

For demo:

$ pod try BedgeNotificHub

To run the example project, clone the repo, and run pod install from the Example directory first.

$ cd Example
$ pod install

If you don't have CocoaPods installed, grab it with [sudo] gem install cocoapods.

$ open BedgeNotificHub.xcworkspace

Requirements

  • iOS 10.0 or later
  • Swift 4.2
  • Xcode 10

Installation

CocoaPods

BedgeNotificHub is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BedgeNotificHub'

Manual Installation

Just drag the BedgeNotificHub.swift files into your project.

Usage

Initialization

let hub = BedgeNotificHub(view: yourView) // Initially count set to 0

Increase count value by 1

hub.increment()

Increase count by some int value

hub.increment(by: Int)

Decrease count value by 1

hub.decrement()

Decrease count by some int value

hub.decrement(by: Int)

Set count to static integer value

hub.setCount(newCount: Int)

Combine actions

mix

hub.increment()
hub.pop()
hub.blink()

Customization

Change the color of the notification circle

setCircleColor

hub.setCircleColor(_ circleColor: UIColor?, label labelColor: UIColor?)

Change the border color and border width of the circle

Custom

hub.setCircleBorderColor(_ color: UIColor?, borderWidth width: CGFloat)

Set the frame of the notification circle relative to the view

setCircle

hub.setCircleAtFrame(_ frame: CGRect)

Move the circle (left/right or up/down)

hub.moveCircleBy(x: CGFloat, y: CGFloat)

Changes the size of the circle. setting a scale of 1 has no effect

hub.scaleCircleSize(by scale: CGFloat)

Hide the count (Blank Bedge)

hideCount

hub.hideCount()

Show count again on the bedge

showCount

hub.showCount()

Animations

Pop out and pop in the bedge

Pop

hub.pop()

Make bedge blinking

Blink

hub.blink()

Animation that jumps similar to OSX dock icons

Bump

hub.bump()

TROUBLESHOOTING

Notification isn't showing up!

  • If the hub value is < 1, the circle hides. Try calling increment().
  • Make sure the view you set the hub to is visible (i.e. did you call self.view.addSubview(yourView)?).
  • Make sure you didn't call hideCount() anywhere. Call showCount() to counter this.

It isn't incrementing / decrementing properly!

  • Any count < 1 doesn't show up. If you need help customizing this, reach out to me!

The circle is in a weird place

  • If you want to resize the circle, use scaleCircleSize(by scale: CGFloat). 0.5 will give you half the size, 2 will give you double.
  • If the circle is just a few pixels off, use moveCircleBy(x: CGFloat, y: CGFloat). This shifts the circle by the number of pixels given.
  • If you want to manually set the circle, call setCircleAtFrame(_ frame: CGRect) and give it your own CGRect.

Something else isn't working properly

Author

Jogendra Kumar

License

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

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.