Stanford - Developing iOS 9 Apps with Swift - 2. Applying MVC

Stanford iOS · 111K views · 2016 · 1:21:13

Open on YouTube

University lectures & coursesSoftware architecture & designSoftware practice, open source & careerslecturedated

Why Stack Overflow recommends it

Stack Overflow users link it as a clear MVC introduction and as a reference for how the course's CalculatorBrain example is structured.

Recommended by 1 people across 1 different months, 2016 to 2017.

What it is

Lecture 2 of Stanford's CS193P course on developing iOS 9 apps with Swift. It explains the Model-View-Controller pattern and applies it to refactor the calculator demo from the previous lecture into a separate CalculatorBrain model.

What people said

Strong rec Paulo Mattos · 2017-05 · Stack Overflow · on “MVC: Is the View allowed to reference mutable elements of the Model without modifying them?”

@Bit Also: this Stanford lesson [this video] provides the *best* MVC introduction that I'm aware of. It's somewhat iOS specific, but highly recommended nevertheless :-)

Cites Robert · 2016-08 · Stack Overflow · on “MVC - NSFetchRequest in model file without UIKit”

In my ViewController, I have a function for fetching all the 'headingNumbers' (an attribute of the entity 'Vocabulary'). I understood that this is not good MVC practice. So I created a new swift file. I did not import UIKit. Youtube Stanford - Developing iOS 9 Apps with Swift - 2, 22:53: "Never import UI KIT in a model file because the model is UI independent" ( [this video] ) However, now I get these messages like "Use of unresolved identifier 'UIApplication'". Which makes sense, as I did not import the UIKit. The question is: how do I now execute a fetch request in my new swift file. (As you probably now by now, I am a beginner) import Foundation import CoreData class QueryData { private var se

Cites Abhi · 2016-09 · Stack Overflow · on “Unprintable ASCII character found in Swift Source Code”

[LINK] Hi, I am new to Swift language , can anyone explain why there is error with PI Symbol here. import Foundation class CalculatorBrain { private var accumulator = 0.0 func setOperand(operand : Double) { accumulator = operand } func performOperations (symbol: String) { switch symbol { case "π" : accumulator = M_PI case "√" : accumulator = sqrt(accumulator) default : break } } var result : Double { get{ return accumulator } } } reference [this video]

Cites Zoomba · 2016-09 · Stack Overflow · on “Can I have function types in Java's Enum like Swift?”

It can be used to make your switch case factor things that the cases have in common. For example [this video] uses it for implementing a calculator; when he wants to switch between different types of functions (e.g. unary, binary, constant, ...)