Functions in Swift | Swift 2.0 Basics | Swift 2.0 Tutorial | Swift Collection Types

Опубликовано: 17 Апрель 2026
на канале: IER- Academy
26
1

This video explain the basics of swift 2.0 programming like functions and collection types.

Objectives and Outcomes of the video :
Understand how to use the collection types such as Arrays, Dictionaries, Sets, and Tuples.
Understand how to decide what collection type to use based on the needs
Understand what a function is and what it does
Write functions that reduce the amount of code you need to write overall
Make your code clean and concise with the help of functions
Recognize when a function could help in your code

Summary of the video :
An array is an ordered collection that stores multiple values of the same type. You can initialize an array with an array literal. An array literal is a list of values, separated by commas, surrounded by a pair of square brackets. You can access specific elements from an array using the subscript syntax. To do this pass the index of the value you want to retrieve within square brackets immediately after the name of the array. Also you can get a sub sequence from the array if you pass a range instead of an index. Swift provides three primary collection types, known as arrays, sets, and dictionaries, for storing collections of values. Arrays are ordered collections of values. Sets are unordered collections of unique values. Dictionaries are unordered collections of key-value associations. Arrays, sets, and dictionaries in Swift are always clear about the types of values and keys that they can store. This means that you cannot insert a value of the wrong type into a collection by mistake. It also means you can be confident about the type of values you will retrieve from a collection. If you create an array, a set, or a dictionary, and assign it to a variable, the collection that is created will be mutable. This means that you can change (or mutate) the collection after it is created by adding, removing, or changing items in the collection. If you assign an array, a set, or a dictionary to a constant, that collection is immutable, and its size and contents cannot be changed.

For More Details Click: http://ieracademy.com