-
Notifications
You must be signed in to change notification settings - Fork 37
fix: remove snapshot view on controller dismissal #11
base: master
Are you sure you want to change the base?
fix: remove snapshot view on controller dismissal #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at my comments. Thank you very much for spotting this bug and submitting a PR.
@@ -133,6 +133,16 @@ public class CardStackController: UIViewController { | |||
imageView.pinEdgesToSuperviewEdges() | |||
} | |||
|
|||
public override func viewWillDisappear(_ animated: Bool) { | |||
super.viewWillDisappear(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think I was just mimicking the approach for viewWillAppear(_:)
without giving it too much thought 😅. Thinking we should just pass along the given animated
value.
|
||
if let imageView = view.subviews[0] as? UIImageView { | ||
imageView.removeFromSuperview() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big fan of this casting and accessing the subviews
array, it could change in the future. It might be better to keep a reference to the snapshot and remove it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I'll push an alternate solution soon.
Got around to cleaning this up, let me know what you think. |
These changes are identical to #8, just using a topic branch as per best practices. Fixes #5.
Worth noting you can witness #5 in action in the README gif when the slider values flash after card dismissal!
Thanks again for such an awesome package ❤️