Programming in Swift - Part 45: Part 5: Structures: | Ray Wenderlich

Learn when it's best to use computed properties, and when it's best to use methods.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3535-programming-in-swift/lessons/45

To make it clear for you to know the difference between stored and computed type properties:
This example from Apple documentation
struct SomeStructure {
static var storedTypeProperty = β€œSome value.”
static var computedTypeProperty: Int {
return 1
}
}

This topic was automatically closed after 166 days. New replies are no longer allowed.