Day: September 27, 2017

Array in Swift

Define empty interger array

You can us isEmpty property to check whether the array is empty Add element to array

You can insert element at specific index

This will add 10 at the index 0 Remove Elements To remove element at specific location you can use remove()

Remove all elemnts


Read more

Get the First Character of String in Swift

To get the first character of String you can use the following code

Output First charter of string : s

Read more

Get the Length of String in Swift

You can get the length of the string following way

Output Length of the string : 9

Read more

String in Swift3

How to define string variable

Escape Characters \\ => If you want to show back slash

Output Hello \World \t => Shows the tab

Output Hello World \n => show new line \” => shows double quote \’”=> shows single quote Joining two strings

Get the length of String

Output […]

Read more

If Statement in Swift 3

Lets see how we can write the If statement in Swift 3 This example show how student gets pass for his subject according to marks If student has marks over 75 he gets A pass If student has marks less than 75 and more than 65 he gets B pass If student has marks less […]

Read more

Comparison Operators in Swift 3

You have following comparison operators in Swift 3 > Greater than < Less than = Greater than or equal to <= Less than or equal to == Exactly equal to != Not equal to

Read more

Variables in Swift 3

In this article you can get understanding of how to work with variables in Swift 3 You can learn how to define variable and understanding different types of variable You can define integer variable without specifying the data type

You can see the following output The result is 5 Integar Data Type You can […]

Read more

Writing Hello Word in Swift 3

In this example I am going to write “Hello World” code in Swift 3. To write the code you can use the Swift Playground So you can run the following code in your Playground

So you will get following output I am learing swift code: Hello World

Read more

How to see the version of Swift in your machine

You can open your terminal and run the following command

You will see following output

Read more