This is an example of a struct definition and a class definition

struct Resolution {
  var width = 0
  var height = 0
}
class VideoMode {
  var resolution = Resolution()
  var interlaced = false
  var frameRate = 0.0
  var name: String?
}

The Resolution structure definition and the VideoMode class definition only describe the appearance of Resolution or VideoMode, create an instance of the structure or class:

let resolution = Resolution(width: 1920)
let someVideoMode = VideoMode()
Comments