In Swift, you can call a public static property on an instance of a class by using the class name followed by the property name.
Here's an example:
main.swift162 chars7 lines
In this example, we define a class called MyClass
with a public static property called myStaticProperty
.
To access this property on an instance of the class, we simply use the class name (MyClass
) followed by the property name (myStaticProperty
).
The output of the program will be "Hello, world!"
, which is the value of the myStaticProperty
property.
gistlibby LogSnag