Swift Tutorial - Tutorialspoint
final get infix inout lazy left mutating none nonmutating optional override postfix precedence prefix Protocol required right se ...
While doing programming in any programming language, you need to use different types of variables to store information. Variable ...
UInt8, UInt16, UInt32, and UInt64 can be used to represent 8 Bit, 16 Bit, 32 Bit and 64 Bit forms of unsigned integer. Bound V ...
Type Safety Swift is a type-safe language which means if a part of your code expects a String, you can't pass it an Int by mista ...
When we run the above program using playground, we get the following result: 42 3.14159 3.14159 ...
A variable provides us with named storage that our programs can manipulate. Each variable in Swift has a specific type, which de ...
When we run the above program using playground, we get the following result: 42 Type Annotations You can provide a type annotati ...
var 你好 = "你好世界" println(你好) When we run the above program using playground, we get the following result. Hello, Swift! 你好世界 Prin ...
Swift also introduces Optionals type, which handles the absence of a value. Optionals say either "there is a value, and it equal ...
Let's take a simple example: import Cocoa var myString:String? myString = "Hello, Swift!" if myString != nil { println(myString) ...
import Cocoa var myString:String! myString = "Hello, Swift!" if myString != nil { println(myString) }else{ println("myString has ...
} When we run the above program using playground, we get the following result: Your string has - Hello, Swift! ...
Constants refer to fixed values that a program may not alter during its execution. Constants can be of any of the basic data typ ...
let constB:Float = 3.14159 println(constB) When we run the above program using playground, we get the following result. 42 3.141 ...
println("Value of \(constA) is more than \(constB) millions") When we run the above program using playground, we get the followi ...
A literal is the source code representation of a value of an integer, floating-point number, or string type. The following are e ...
String Literals A string literal is a sequence of characters surrounded by double quotes, with the following form: "characters" ...
Boolean Literals There are three Boolean literals and they are part of standard Swift keywords: A value of true representing t ...
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Objective-C is rich i ...
-- Decrement operator decreases integer value by one A-- will give 9 Comparison Operators The following table shows all the rela ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf