All Projects → kiwisip → BadgeControl

kiwisip / BadgeControl

Licence: MIT license
Badge view with controller written in Swift 5.0

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to BadgeControl

ETBadge
A tool of swift to add or clear badge for any UIView。You can use it easily, also can custom it.
Stars: ✭ 19 (-64.15%)
Mutual labels:  uiview, badge
SwiftGradients
Useful extensions for UIViews and CALayer classes to add beautiful color gradients.
Stars: ✭ 15 (-71.7%)
Mutual labels:  uiview, swift5
YRipple
iOS Ripple Effect, Xcode10 and Swift5 available
Stars: ✭ 18 (-66.04%)
Mutual labels:  uiview, swift5
Ppbadgeview
iOS Custom Badge, Support UIView, UITabBarItem, UIBarButtonItem ,Support Objective-C/Swift; iOS自定义Badge组件, 支持UIView, UITabBarItem, UIBarButtonItem, 支持Objective-C/Swift
Stars: ✭ 807 (+1422.64%)
Mutual labels:  uiview, badge
Render
UIKit a-là SwiftUI.framework [min deployment target iOS10]
Stars: ✭ 2,150 (+3956.6%)
Mutual labels:  uiview
Easytipview
Objective-C alternative for EasyTipView implemented in swift
Stars: ✭ 192 (+262.26%)
Mutual labels:  uiview
Inappviewdebugger
A UIView debugger (like Reveal or Xcode) that can be embedded in an app for on-device view debugging
Stars: ✭ 1,805 (+3305.66%)
Mutual labels:  uiview
Instagramactivityindicator
Activity Indicator similar to Instagram's.
Stars: ✭ 138 (+160.38%)
Mutual labels:  uiview
VSMarketplaceBadge
Badge for Visual Studio Code Extension
Stars: ✭ 63 (+18.87%)
Mutual labels:  badge
octocov
octocov is a toolkit for collecting code metrics (code coverage, code to test ratio and test execution time).
Stars: ✭ 191 (+260.38%)
Mutual labels:  badge
IBLayoutConstraint
📏 Configure constraints for each device in Interface Builder with IBLayoutConstraint.
Stars: ✭ 24 (-54.72%)
Mutual labels:  swift5
Animation Extensions
A set of most commonly used animations like rotation, shake, flip or motion effects. All in one UIView extension.
Stars: ✭ 198 (+273.58%)
Mutual labels:  uiview
Teller-iOS
iOS library that manages your app's cached data with ease.
Stars: ✭ 12 (-77.36%)
Mutual labels:  swift5
Swift-FFDB
a Object/Relational Mapping (ORM) support to iOS and MacOS .Since SwiftFFDB is build on top of FMDB.
Stars: ✭ 22 (-58.49%)
Mutual labels:  swift5
BadgesGenerator
A Swift playground to automatically generate personalized conference badges.
Stars: ✭ 36 (-32.08%)
Mutual labels:  badge
Uicard
Generic UI for card games like Hearthstone, Magic Arena and Slay the Spire...
Stars: ✭ 142 (+167.92%)
Mutual labels:  uiview
Keepwords
📱🔐 Need an iOS password managing app with no pods? We got you covered!
Stars: ✭ 17 (-67.92%)
Mutual labels:  swift5
UberCarAnimation
This app is for animating a car like uber from one position to another with preserving angle and smooth animation
Stars: ✭ 53 (+0%)
Mutual labels:  swift5
MMAdvertScrollView
一个简单、轻量级的swift版公告轮播框架
Stars: ✭ 42 (-20.75%)
Mutual labels:  swift5
extensions-kit
📦 Collection of Swift+Apple Frameworks extensions for speeding up software development [iOS & iPadOS].
Stars: ✭ 71 (+33.96%)
Mutual labels:  uiview

defaultboomall

BadgeControl

  • Simply attach BadgeController to any UIView's subclasses and easily control the badge.
  • Customize size, position, background color, text color, border width, border color and animation of the badge.

Setup

Setup with CocoaPods (iOS 9+)

  • If you are using CocoaPods add this text to your Podfile and run pod install.
    pod 'BadgeControl'

Add source (iOS 9+)

Usage

Add import BadgeControl to your source code (unless you used the file setup method).

Simply attach BadgeController to your UIView (or its subclass).

let badge = BadgeController(for: myUIView)

Add an empty badge and present it with animation.

badge.addOrReplaceCurrent(animated: true)

Add a badge with text and present it with animation.

badge.addOrReplaceCurrent(with: "1", animated: true)

Remove badge from its view.

badge.remove(animated: true)

Simply increment or decrement the value on your badge (if it is numeric) and present it with animation.

badge.increment(animated: true)
badge.decrement(animated: true)

You can also set animateOnlyWhenBadgeIsNotYetPresent = true if you don't want animation when badge is already present on the view.

Customization

You can customize badge's text font, background color, text color, border width, border color, size, center position and animation.

Text font, background color, text color, border width, border color and size

badge.badgeTextFont = UIFont.systemFont(ofSize: 15)
badge.badgeBackgroundColor = UIColor.blue
badge.badgeTextColor = UIColor.yellow
badge.borderWidth = 3 // in px
badge.borderColor = UIColor.black // black is default
badge.badgeHeight = 20 // badge will have height of 20px

Center position

You can choose following center positions: upperLeftCorner, upperRightCorner, lowerLeftCorner, lowerRightCorner.

You can also choose custom position by calling .custom(x: Double, y: Double).

badge.centerPosition = .upperLeftCorner
badge.centerPosition = .custom(x: 10, y: 20)

Animations

You can choose one of the following animations:

Default animation

default

badge.animation = BadgeAnimations.default
Left-right animation

default

badge.animation = BadgeAnimations.leftRight
Right-left animation

default

badge.animation = BadgeAnimations.rightLeft
Fade in animation

default

badge.animation = BadgeAnimations.fadeIn
Rolling animation

default

badge.animation = BadgeAnimations.rolling
Custom

You can also provide your own animation of type ((UIView) -> Void).

badge.animation = { badgeView in
    ...
  }

Initialization

You can use this initalizer with default values:

public init(for view: UIView,
            in centerPosition: BadgeCenterPosition = .upperRightCorner,
            badgeBackgroundColor: UIColor = .red,
            badgeTextColor: UIColor = .white,
            badgeTextFont: UIFont? = nil,
            borderWidth: CGFloat = 0.0,
            borderColor: UIColor = .black,
            animation: ((UIView) -> Void)? = BadgeAnimations.defaultAnimation,
            badgeHeight: Int? = nil
            animateOnlyWhenBadgeIsNotYetPresent: Bool = false)

License

BadgeControl is released under the MIT License.

Feedback is welcome

If you've found a bug or want to improve BadgeControl feel free to create an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].