Sorting swift array
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
Understanding swift defer statement
Defer statement in swift is executed just before the control exits the scope in which defer is defined. Swift’s official document states
Convert degrees to radians and radians to degrees
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
Latest way to Set A Root View Controller Programmatically in Swift
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.
Deleting 9gag comments easily
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.
A quick guide to the swift timer
Easy examples to basic swift timer functionality like passing user info, creating repeating swift timers invalidating swift timers and more
SwiftUI creating views in a loop using ForEach
. In SwiftUI we can create views in a loop using ForEach. ForEach is a view structure i.e you can use it directly in the body. Example code is given below
Remove a file from tracking in git
So you have added a new file to .gitignore or you have just added a new .gitignore file to your existing repo. The problem is same you don’t want git to rack one or many files. This can be archived in simple 3 step process. Assuming that you have already added or updated .gitignore file … Read more
Delete a git branch from local and remote
Git branch can be deleted easily using following commands Most of the time remote name is origin. For deleting git branch locally you can use following command If you are working in a large team and you don’t want to keep deleted branch locally you can prune your repo by using following command Hope this … Read more