To call a setter on an instance of a class in Swift, you simply assign a new value to the property using dot notation. Here's an example class with a simple property and its setter:
146 chars8 linesTo call the setter setMyProperty on an instance of MyClass, you would do the following:
87 chars3 linesHowever, a better option is to directly set the property to the new value using the dot notation:
67 chars3 linesThis will call the setter method automatically and update the property value.
gistlibby LogSnag