Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tutorial #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add init for bar buttom item
besilva committed Oct 19, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit abb3b626584db73db87f72324239c87e38930889
20 changes: 13 additions & 7 deletions BadgeHub/Classes/BadgeHub.swift
Original file line number Diff line number Diff line change
@@ -67,13 +67,19 @@ public class BadgeHub: NSObject {
setView(view, andCount: 0)
}

// convenience init(barButtonItem: UIBarButtonItem?) {
// if let value = barButtonItem?.value(forKey: "view") as? UIView {
// self.init(view: value)
// scaleCircleSize(by: 0.7)
// moveCircleBy(x: -5.0, y: 0)
// }
// }
public convenience init?(barButtonItem: UIBarButtonItem) {
if let value = barButtonItem.value(forKey: "view") as? UIView {
self.init(view: value)
scaleCircleSize(by: 0.7)
moveCircleBy(x: -5.0, y: 0)
} else if let value = barButtonItem.customView {
self.init(view: value)
scaleCircleSize(by: 0.7)
moveCircleBy(x: -5.0, y: 0)
} else {
return nil
}
}

// Adjustment methods
public func setView(_ view: UIView?, andCount startCount: Int) {