Protocols are a way of specifying how to use an object. They describe a set of properties and methods which a class, structure, or enum should provide, although protocols pose no restrictions on the implementation.
“ An optional value either contains a value or contains nil to indicate that a value is missing”
Excerpt From: Apple Inc. “The Swift Programming Language (Swift 3.1 Edition).” iBooks. https://itun.es/us/k5SW7.l
Basic optional use cases include: for a constant (let), use of an optional within a loop (if-let), safely unwrapping an optional value within a method (guard-let), and as part of switch loops (case-let), defaulting to a value if nil, using the coalesce operator (??)
Array is an ordered, random-access collection type.
Arrays are one of the most commonly used data types in an app. We use the Array type to hold elements of a single type, the array's Element type. An array can store any kind of elements---from integers to strings to classes.
A tuple type is a comma-separated list of types, enclosed in parentheses.
This list of types also can have name of the elements and use those names to refer to the values of the individual elements.
An element name consists of an identifier followed immediately by a colon (:).
Common use -
We can use a tuple type as the return type of a function to enable the function to return a single tuple containing multiple values
Design Patterns - Creational
Design patterns are general solutions to problems that frequently occur in software development. The following are templates of standardized best practices in structuring and designing code, as well as examples of common contexts in which these design patterns would be appropriate.
Creational design patterns abstract the instantiation of objects to make a system more independent of the process of creation, composition, and representation.