assigning value to Read-only computed property
<p>everyone. I am learning swift and Xcode. and following this <a href="https://www.raywenderlich.com/90488/calayer-in-ios-with-swift-10-examples" rel="nofollow">https://www.raywenderlich.com/90488/calayer-in-ios-with-swift-10-examples</a>
to learn. i follow every step to do. but i have seen this code:</p>

<pre><code>import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var viewForLayer: UIView!

    var l: CALayer {
        return viewForLayer.layer
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        setUpLayer()
    }

    func setUpLayer() {
        l.backgroundColor = UIColor.blueColor().CGColor
        l.borderWidth = 100.0
        l.borderColor = UIColor.redColor().CGColor
        l.shadowOpacity = 0.7
        l.shadowRadius = 10.0
    }

}
</code></pre>

<p>obviously, <code>l</code> is read-only computed property.
so how <code>setUpLayer()</code> assigns values to <code>1</code>?</p>

<p>I used playground to try to assign values to a struct or a class, but it didn't work.</p>

<p>how does this function work?</p>

<p>thanks!</p>