To add a public property to a class in Swift, simply declare the property within the class with the public
access modifier. For example:
main.swift141 chars8 lines
In the example above, the myProperty
property is defined as public
and can be accessed and modified from outside the class.
gistlibby LogSnag