Learning Swift — Days 125-127

Hacking with Swift — Day 99 — Consolidation Day X Applying MVC to the project An MVC Recap The Model is the what or our application (but not how it is displayed). The Controller is how our model is presented to the user (and represents the UI logic) and the view is our controller’s minions!Continue reading “Learning Swift — Days 125-127”

Learning Swift — Days 123-124

Swift Language Reference Day 123: Declarations (cont.) Special Kinds of Parameters: parameters can be ignored, take a variable number of values, and provide default values. An underscore (_) parameter is explicitly ignored and can’t be accessed within the body of the function. A parameter with a base type name followed immediately by three dots (…)Continue reading “Learning Swift — Days 123-124”

Learning Swift — Days 120-122

Swift Language Reference Day 120 part 2 Let’s now delve into the Language Reference. It should not be too long before I can start building apps again! Lexical Structure The lexical structure of Swift describes what sequence of characters form valid tokens of the language. These valid tokens form the lowest-level building blocks of theContinue reading “Learning Swift — Days 120-122”

Learning Swift — Days 117-120

Review of the Swift Programming Language Day 117 part 2 Generics Generic code enables us to write flexible, reusable functions and types that can work with any type, subject to requirements that we define. We can write code that avoids duplication and expresses its intent in a clear, abstracted manner. The Problem That Generics SolveContinue reading “Learning Swift — Days 117-120”

Learning Swift — Days 114-117

Review of the Swift Programming Language Day 114 Type Methods: we indicate type methods by writing the static keyword before the method’s func keyword. Classes can use the class keyword instead, to allow subclasses to override the superclass’s implementation of that method. Subscripts Subscript Syntax: subscripts enable you to query instances of a type byContinue reading “Learning Swift — Days 114-117”