At the Cuble think tank earlier this week, the phrase ‘Catfish’ kept coming up a lot on the idea board as a team member named Joe finally met his long term online significant other. Unfortunately for…
When writing tests that might invoke this function, with the animated parameter set to bool, in a normal behaviour `self.transitionCoordinator` is not nil when animated is set to true, but since no actual transition is happening (in a unit test), it is nil, and it breaks the completion block.
So I needed a way to set animation to false, even if it was set to true from the outside during unit tests. `#if DEBUG` was not an option, obviously.
I did further digging and noticed that if you run Thread.current.threadDictionary
the thread running the XCTest
contains the following key: com.apple.dt.xctest.waiter-manager
So I wrote this extension:
I opted to check for xctest
alone and not the whole key to future proof it, from any possibile changes to the key.
So now the code looks like this:
If you liked this article, you may like this:
Here is my twitter:
It continues to amaze me how important a strong mind is in the world. I’m sometimes concerned that we are not allowing our kids to fail and learn to cope with different situations. I have read…
Astrology has been around for many years, thousands of years; to be exact, it has been around for 2400 years and maybe even more. It began by spreading in the eastern Mediterranean; it’s also…
In 2010 United Nations (UN) Department of Public Information, launched an initiative establishing language days for each of the UN’s six official languages. The purpose of language days is to…