@@ -62,6 +62,24 @@ class SecondaryView: UIView {
63 private var animate: Bool = false
63 private var animate: Bool = false
65+ private func cleanCards() {
66+ outLoop: for (i, element) in cards.arrangedSubviews.enumerated() {
68+ case .view(let card):
69+ let cardFrame = convert(card.frame, from: cards)
70+ if cardFrame.intersects(bounds) {
73+ cards.arrangedSubviews.remove(at: i-1)
74+ cards.arrangedSubviews.remove(at: i-1)
80+ print(cards.arrangedSubviews.count)
65 private let padding = CGPoint(x: 32, y: 32)
83 private let padding = CGPoint(x: 32, y: 32)
67 override func layoutSubviews() {
85 override func layoutSubviews() {
@@ -72,10 +90,13 @@ class SecondaryView: UIView {
72 self.cards.frame.origin.x = self.frame.width - self.padding.x - self.cards.frame.width
90 self.cards.frame.origin.x = self.frame.width - self.padding.x - self.cards.frame.width
74 if animate {
92 if animate {
75− UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.6, options: [], animations: updates, completion: nil)
93+ UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.6, options: [], animations: updates, completion: { _ in
76// UIView.animate(withDuration: 0.4, delay: 0.0, options: [.curveEaseOut], animations: updates, completion: nil)
96// UIView.animate(withDuration: 0.4, delay: 0.0, options: [.curveEaseOut], animations: updates, completion: nil)
80 animate = false
101 animate = false