How to get index in swift for loop
There are interesting ways to use swift for loop. In the below example you will see how you can iterate over a collection and ..
There are interesting ways to use swift for loop. In the below example you will see how you can iterate over a collection and ..
Swift has a random function, build in the language core. It can be used to generate random values for float, Int, Double and Bool. The below code examples will make the usage clear
In my role as an iOS developer and manager, I come across situations where I get full source code from our freelancers and associates. Whenever there is the latest version of Xcode released we get keen on knowing which Xcode was last used to develop the app? Why this question is important? The need to … Read more
In swift a String can be converted into a Int in a very easy and safe way. Below example will show how we can easily convert a String to an Int value nil coalescing can also be used if we wish to return a default value in case of a invalid string Hope this helps!!!
If you have got a string which is separated using any delimiter like ‘,’ or space or ‘|’ or any other fixed delimiter, you can easily split it in swift by using the following function
We can easily sort a swift array using two provided function array.sort array.sorted We will see both array.sort() and array.sorted() in action and will understand how they differ from each other in a subtle way, while sorting a swift array in place and returning a sorted copy of the swift array. Example code for the … Read more
Defer statement in swift is executed just before the control exits the scope in which defer is defined. Swift’s official document states
In real life, we are used to degrees and in programming, we deal mostly with radians. If you are dealing with drawing specifically arc and circles you will come across situations where you have to toggle between degrees and radians and at other times between radians to degrees. Relationship between Degrees and Radian The above … Read more