minitour / easynotificationbadge Goto Github PK
View Code? Open in Web Editor NEWUIView extension that adds a notification badge.
License: MIT License
UIView extension that adds a notification badge.
License: MIT License
Hi, will you be adding Swift 4 support to this project?
I was using it for add badge on barbuttonitem . but its not working
I am getting crash on the
fatal error: unexpectedly found nil while unwrapping an Optional value
I'd be cool to also add Cocoapods support. I done this implementation myself last month for my library. Just follow this post and this checklist.
For safety, avoid using as!
or a var with !
Is there a chance to have the compatibility with Swift 5?
Updated podfile from:
pod 'Koloda', '-> 4.3.1'
to:
pod "Koloda"
After that badgeAppearance.textSize = 14
gives the follow message: "Value of type 'BadgeAppearance' has no member 'textSize'"
.
Downloaded GitHub repository and tested example project and got same behavior.
Was the removal of textSize
property intended?
It is not possible to set the centerY (and centerX) offsets to 0. The following code prevents this. However 0 is a valid value to center align precisely.
//The distance from the center of the view (vertically)
let centerY = appearance.distanceFromCenterY == 0 ? -(bounds.size.height / 2) : appearance.distanceFromCenterY
//The distance from the center of the view (horizontally)
let centerX = appearance.distanceFromCenterX == 0 ? (bounds.size.width / 2) : appearance.distanceFromCenterX
A workaround is to set distanceFromCenterY
or distanceFromCenterX
to a very small non zero value such as 0.01 but it feels yucky!
Description
I've tried to set badge to UIBarButtonItem
but badge is not visible.
Code I've used
let filterButton = UIBarButtonItem(image: #imageLiteral(resourceName: "filter"),
style: .plain,
target: self,
action: nil)
filterButton.tintColor = .primary
filterButton.badge(text: "2")
Workaround
Instead of creating UIBarButtonItem with image create it using customView
constructor
let filterButton = UIBarButtonItem(customView: UIImageView(image: #imageLiteral(resourceName: "filter")))
filterButton.tintColor = .primary
filterButton.action = #selector(filter(_:))
filterButton.customView?.badge(text: "2")
navigationItem.rightBarButtonItem = filterButton
Thanks for great lightweight library.
Best regards,
Najdan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.