main.swift259 chars12 lines
In the example above, we use the class
keyword to define a new class called Person
.
The class has three properties: firstName
, lastName
, and email
, which are of type String
.
To create a new instance of this class, we define an init
method that takes three arguments: firstName
, lastName
, and email
. In the implementation of the init
method, we assign these arguments to the corresponding properties of the new instance using self
.
gistlibby LogSnag