Unexpectedly found nil while unwrapping an Optional value in Swift application : <p>I’m building an app with Swift. 
I have this code in my class:</p>

<pre><code>var url : Url? = Url()
</code></pre>

<p>on ViewDidLoad() method I have this:</p>

<pre><code>override func viewDidLoad() {
        super.viewDidLoad()

        //recuper ip di arduino
        url = UrlCoreDataController.shared.loadUrl()!

        self.setUpLuci()
        //    self.tabella.dataSource = self
        //    self.tabella.delegate = self
    }
</code></pre>

<p>the loadUrl() method can return nil value.</p>

<p>So if the method return nil value I have this error:</p>

<pre><code>2018-03-06 12:29:47.150240+0100 ArduinoHomeKit_bis[2318:1060982] [error] error: CoreData: error: Failed to call designated initializer on NSManagedObject class 'Url'
CoreData: error: CoreData: error: Failed to call designated initializer on NSManagedObject class ‘Url'
</code></pre>

<p>How can I change my code ?</p>
