I was recently working on an application which required me to display an animation which scales a
UIView down to zero. The approach I took was to apply a
CGAffineTransform (with scale factor set to zero) to the
UIView in a
UIView.animate() block. However, when I implemented this, the view did not animate but just disappeared from the UI. The problem turned out to be something which is not really obvious from the iOS docs and hence I decided to write up this post in the hope that it will help others.
This is the behaviour I wanted to implement -
If you are an iOS developer, at one point or another you will run into an
EXC_BAD_ACCESS crash. If you have already tried enabling
NSZombie without any luck (thus ruling out memory problems / dangling pointers), a potential cause could be a Data Race Condition in your code. This post discusses what a Data Race Condition is and how you can use the Thread Sanitizer to debug the issue.
What is a Data Race Condition?
A Data Race Condition occurs when multiple threads access the same memory location without synchronization and atleast one of these accesses is a write.