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
While trying to set a custom rootViewController in swift with a UIWindow, in the traditional way results in a black screen. The reason is now we need to use UIWindowScene to create a UIWindow instance.
It is a very tough job to delete 9gag comments from a very active thread as your comment will be hidden somewhere amongst thousands of comments. But I will share with you an easy way to do it. Using this method you will be able to go to your comments directly one by one and delete them no need to search for needles in a haystack.