Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: Expression following 'return' is treated as an argument of the 'return'

I get this warning in my code and I can't figure out what it means and what I need to do to fix it. The warning says the following:

Expression following 'return' is treated as an argument of the 'return'

And it's shown on this line:

// Tell Realm to use this new configuration object for the default Realm

Can someone explain what I'm doing wrong? See code part below.

Some background info, the code is part of a database manager class which I use to migrate a unencrypted realm database to an encrypted one, if the encrypted db doesn't exist yet. If the encrypted db already exists, it configures realm to use this one as default. If it cannot open it (e.g. because of wrong encryption key) it creates a new database.

let exists = self.encryptedDatabaseExists(config)
if exists {
    //Try to open Realm with new config. If unsuccessful, it needs to be removed and a new one created
    do {
        _ = try RLMRealm(configuration: config)

        // Tell Realm to use this new configuration object for the default Realm
        RLMRealmConfiguration.setDefaultConfiguration(config)
        RLMRealm.defaultRealm()
    } catch let err {
        Log.error("Encrypted DB could not be opened: \(err)")
        self.createNewEncryptedDatabase(config)
    }
} else {
    self.migrateToEncryptedDatabase(config)
}
like image 454
Paul van Roosendaal Avatar asked Apr 21 '16 12:04

Paul van Roosendaal


1 Answers

Swift 5 Easy way enjoy it

//MARK:- Use it like function its will work
return()
like image 189
Shakeel Ahmed Avatar answered Oct 15 '22 16:10

Shakeel Ahmed