jkpang/PPBadgeView

Value of type 'PP<UIBarButtonItem>' has no member 'setBadgeLabel' !

X901 opened this issue · 4 comments

X901 commented

what happened to this function?

buttonItem?.pp.setBadgeLabel(attributes: { (badgeLabel) in
      badgeLabel.font = UIFont.systemFont(ofSize: 13)
      badgeLabel.textColor = UIColor.blue
})

in the last version and Swift 5
it gives me an error

Value of type 'PP' has no member 'setBadgeLabel'

From what I gathered, it has been removed in favor of BadgeControl!
See 1a7724d for more information.

@X901 Any solution found?

Not a solution, but a workaround:

  1. Set the property textLabel public instead of private in PPBadgeControl

  2. Convert the code, from:

buttonItem?.pp.setBadgeLabel(attributes: { (badgeLabel) in
      badgeLabel.font = UIFont.systemFont(ofSize: 13)
      badgeLabel.textColor = UIColor.blue
})

to

buttonItem?.pp.badgeView.textLabel.font = UIFont.systemFont(ofSize: 13)
buttonItem?.pp.badgeView.textLabel.textColor = UIColor.blue

my 2c,

@jkpang could you help ?