Programare swift Swift tutorial from tutorials point | Page 7
Swift 4
Sequence Based Initialization ................................................................................................................ 70
Filtering ................................................................................................................................................. 71
Dictionary Grouping .............................................................................................................................. 71
Accessing Dictionaries ........................................................................................................................... 71
Modifying Dictionaries .......................................................................................................................... 72
Remove Key-Value Pairs ........................................................................................................................ 73
Iterating Over a Dictionary .................................................................................................................... 74
Convert to Arrays .................................................................................................................................. 75
The count Property ............................................................................................................................... 76
The empty Property .............................................................................................................................. 76
18. SWIFT 4 – FUNCTIONS ....................................................................................................... 77
Function Definition ............................................................................................................................... 77
Calling a Function .................................................................................................................................. 78
Parameters and Return Values .............................................................................................................. 78
Functions without Parameters .............................................................................................................. 79
Functions with Return Values ................................................................................................................ 79
Functions without Return Values .......................................................................................................... 80
Functions with Optional Return Types .................................................................................................. 80
Functions Local Vs External Parameter Names ...................................................................................... 81
External Parameter Names ................................................................................................................... 82
Variadic Parameters .............................................................................................................................. 82
Constant, Variable, and I/O Parameters ................................................................................................ 83
Function Types & its Usage ................................................................................................................... 84
Using Function Types ............................................................................................................................ 85
Function Types as Parameter Types & Return Types ............................................................................. 85
Nested Functions .................................................................................................................................. 86
vi