Skip to content

Commit

Permalink
Animate notification dot
Browse files Browse the repository at this point in the history
  • Loading branch information
ivnsch committed Jun 11, 2020
1 parent 89ccff8 commit 415f81a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CoEpi/ui/home/HomeItemCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class HomeItemView: UIView {
@IBOutlet weak var descrLabel: UILabel!
@IBOutlet weak var backgroundView: UIView!


override func awakeFromNib() {
super.awakeFromNib()
notificationView.layer.cornerRadius = 20
Expand All @@ -59,6 +58,16 @@ class HomeItemView: UIView {
notificationLabel.text = item.notification?.text
titleLabel.text = item.title
descrLabel.text = item.descr

if item.notification != nil {
notificationView.transform = CGAffineTransform(scaleX: 0, y: 0)
notificationLabel.alpha = 0
UIView.animate(withDuration: 0.5, delay: 0.5, usingSpringWithDamping:
0.6, initialSpringVelocity: 0.6, options: .curveEaseOut, animations: {
self.notificationView.transform = CGAffineTransform(scaleX: 1, y: 1)
self.notificationLabel.alpha = 1
}, completion: nil)
}
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
Expand Down

0 comments on commit 415f81a

Please # to comment.