We can write functions without any return values . That means, if you call the function, it will return no value and the program will continue running from the next line. Example :.
ReadSometimes we need to change one part of a string . Suppose you have three different types of url for your image - "http://mysite.com/image/myimage.jpg" for default size, "http://mysite.com/image/myimageh360w360.jpg" for "360*360" sized image and "http://mysite.com/image/myimageh100w100.jpg" for "100*100" sized image. You have access only to the first url and you will have to change it like second and third url. How to do that ?
ReadWhile running a code on background thread, sometimes we need to push a code on to the main thread. In this tutorial, we will learn how to achieve this while developing ios apps in Swift 4 . Let's take a look :.
ReadSuppose your program has a loop ( for or while ) and you want to skip some specific conditions, i.e. you don't want to run the code inside the loop for these conditions. 'continue' statement is used for that. It informs the loop to stop for that iteration and continue from the next iteration. In this tutorial , we will check different use cases of 'continue'. 'The syntax used for 'continue' is :.
ReadIn this tutorial, we will learn about while and repeat-while loops in swift. For both cases, I have added one example :.
ReadFor-in loop is used to iterate over sequence like array, dictionary, string etc. In this example, I will show you use of for-in loop with different examples.Drop a comment if you have any queries.
ReadSwitch statement takes a value and compare it with different cases. If any case matches, it runs a block of code. It is like using multiple 'if' conditions and checking each of them one by one. A switch statement can be defined as below :.
ReadDictionaries are Collection that store key-value paired items.The values are of same type and all items are stored without any order. You can access any item using its key. It is not required that the keys should be a number always. All the keys should be of the same type and unique.A dictionary can be variable or constant in swift.
ReadPreviously we have discussed about arrays in swift. Similar to array, set is another collection data type in swift. The main difference is that the elements in a set are unordered and it contain only unique elements. In this tutorial, we will show you how to create a set and different set operations :.
ReadIntroduction with examples to swift array for beginners. Swift array is used to store values of similar type. This post will show you how to use swift array with examples.
Read