What makes a property a computed property in Swift
<p>Let's started with the code snippet:</p>

<pre><code>St Foo {
    var proA: Int = 0 { // needs initialization
        willSet {
            print("about to set proA to \(newValue) from \(proA)")
        }
        didSet {
            print("already set proA to \(proA) from \(oldValue)")
        }
    }

    var ProB: Int { // do not needs initialization 
        return 1
    }
}

let foo = Foo()
foo.proA = 23
print(foo.ProB)
</code></pre>

<p>Here are some of my personal understandings about the the stored and computed property:</p>

<p>a: Property with only the observer (willSet and didSet) is not a computed property but a stored property (ex. the <strong>proA</strong> property in the code above).</p>

<p>b: Computed property must not has initialization (See the comments of the code above).</p>

<p>c: setter is kind of equal to the property observer, the property observer is just the setter + the observer to of the before and after mutating.</p>

<p><strong>Questions:</strong></p>

<p><strong>1.</strong> I wonder what makes a property a computed property? Is it correct that as long as the property has a getter and return it is a computed property? </p>

<p><strong>2.</strong> Are all my understandings (a, b &amp; c) correct? If not, would be nice of you to point out.</p>

<p><strong>3.</strong> Why is it not allowed to initialize an computed property? (Please see the figure below) And when I do so the compiler gives out the warning <strong><em>Cannot call value of none-function type "int"</em></strong> What's the meaning of this error?</p>

<p><a href="https://i.stack.imgur.com/hXXVZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hXXVZ.png" alt="enter image description here"></a></p>

<p>Thanks a lot.</p>