swift

swift

Different return types in swift functions

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 :.

Read
swift

Swift 4 Tutorial : Split and Join a String

Sometimes 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 ?

Read
swift

How to run a piece of code on main thread in Swift 4

While 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 :.

Read
swift

Swift 4 tutorial : continue statement

Suppose 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 :.

Read
swift

Swift 4 while and repeat-while loop tutorial with example

In this tutorial, we will learn about while and repeat-while loops in swift. For both cases, I have added one example :.

Read
swift

Swift 4 for-in loop Tutorial with Example

For-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.

Read
swift

Swift switch tutorial with Example

Switch 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 :.

Read
swift

Swift 4 Tutorial : Dictionary

Dictionaries 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.

Read
swift

Swift Set tutorial : Create, access, modify and iterating a Set

Previously 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 :.

Read
swift

Introduction to Swift Array - swift 3/swift 4/swift 5

Introduction 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