Declare instance variable in Swift : optional vs forced unwrapping vs initial value
<p>This is a basic question about the best practice in swift to declare a swift class with instance variable, all the values will be received from Firebase callback. What is the best approach among these choices or let me know if there another better way: </p>

<p>Solution 1: </p>

<pre><code>class User: NSObject {
    var name:String = ""

    override init() {
        super.init()
    }
}
</code></pre>

<p>Solution 2:</p>

<pre><code>class User: NSObject {
    var name:String!

    override init() {
        super.init()
    }   
}
</code></pre>

<p>Solution 3:</p>

<pre><code>class User: NSObject {
    var name:String?

    override init() {
        super.init()
    }   
}
</code></pre>

<p>Solution 4:</p>

<pre><code>class User: NSObject {

    var name:String

    override init() {
        super.init()
        // Now I need to init name variable here
    } 
}
</code></pre>