About 15,400 results
Open links in new tab
  1. Computed read-only property vs function in Swift

    Semantically speaking, computed properties should be tightly coupled with the intrinsic state of the object - if other properties don't change, then querying the computed property at different …

  2. swift - Property getters and setters - Stack Overflow

    Setters/getters in Swift are quite different than ObjC. The property becomes a computed property which means it does not have a backing variable such as _x as it would in ObjC. In the …

  3. Published computed properties in SwiftUI model objects

    Jul 20, 2020 · I want to add a computed property to GroupOfTallies that resembles the following: // Returns the sum of counts of all elements in the group var cumulativeCount: Int { return …

  4. Set value to computed properties in SWIFT - Stack Overflow

    Apr 17, 2015 · It has no independent existence. The purpose of the setter in a computed property is not to set the value of the property but to set the values of other properties, from which the …

  5. Swift: Computed Property - call function when value changed

    Jun 29, 2023 · Any reference to selectedIndex is just calling the computed property again. The accepted answer is the right thing to do in this instance, but should you need a computed …

  6. swift - Computed Property - Stack Overflow

    Nov 28, 2021 · A computed property calculates its value depending on other values (in the object). An efficient solution is a switch statement

  7. swift - Protocol with computed properties - Stack Overflow

    Dec 6, 2018 · Is there a specific reason that swift limits us from providing computed properties inside a protocol declaration? As we only have the opportunity to set those computed …

  8. SwiftUI: ObservableObject with a computed property

    Jul 5, 2020 · It will computed if the Published value changes inside the class. As the computed value depends on that Published value, it will recalculated when the Published changes. So …

  9. swift - Difference between computed property and property set …

    Jul 2, 2018 · Generally you do this when the computed property needs to be recalculated every time you reference the stored property (e.g. recalculated from other, possibly private, stored …

  10. swift - Are computed properties evaluated every time they are …

    Jan 29, 2016 · Note #2: let's talk about Computed Properties. So we made clear that code in this question is not a Computed Property. However, as EmilioPelaez noted in another comment …

Refresh