MVC – Model View Controller

The Model :  Where your data resides.

The View: What the user sees – view of your app.

The Controller: Used to facilitate communication between the model and the view.

Class & Objects

  • Class is a blueprint used to create objects.
  • Class contains the specifications and the object is something which is actually created using those specifications.
  • Properties : Variables and constants inside the classMethods : Function created inside the class are called Methods
  • Init used to create an event which describes what should be done when an object is created using the class.
import Foundation

class Question {
    let questionText : String
    let answer : Bool
    init(text: String, correctAnswer: Bool) {
    questionText = text
    answer = correctAnswer


How to hide a button / Change text value of the button via code : 

// buttonName = name of the button
// variable - holds the string which we want the button to show
// .normal refers to the state

buttonName.setTitle(variable, for: .normal)

// How to hide the button

buttonName.isHidden = true