Race condition happens when 2 or more threads access the shared data at the same time and change its value at the same time resulting in unexpected state.
A simple example is the typical ATM withdraw problem.
ATM withdraw problem
Let’s say we have our own bank account system and we have ATMs depoloyed all over the town to make withdrawl easy.
It’s been a while I’ve updated my posts. Here are some new tips that makes coding with swift cool.
@autoclosure
@autoclosure attribute defines an argument that automatically gets wrapped in a closure. It’s used to defer the execution of an expression to the site of use, rather than when the argument is passed.
It’s a common requirement to tweak different configurations of the app for debug purposes. The general way of doing it is using Settings.bundle where the Settings are located inside Setting of the iPhone. It has a few drawbacks..
Setting up Settings.bundle is a hassale and needs some research do to
Creating custom pages and changing values on the go are hard
There are limitations to what values you can set
It’s just cubersome to go back to settings to see how app behavior changes when some configs are tweaked.
Property List is a convenient and flexible format for saving data. It was originally defined by apple, to use in iOS devices and later extended to various apps. Plist internally is actually an XML file and can easily be converted to JSON file format as well.
Xcode provides a nice visual tool to edit and view contents of a .plist file.
Since a complex number is comprised of a real and imaginary component, two complex numbers are equal if and only if their respective real and imaginary components are equal.