Can someone explain what is the issue with non-static members here:
import Foundation
let defaults = UserDefaults.standard // E642: Cannot access non-static member "standard" on type "NSUserDefaults!"
let userValues = defaults.object(forKey: "UserValues") as? [String: String]
if (userValues == nil || userValues!.count == 0) {
// No static member "main" on type "Bundle":
if let path = Bundle.main.path(forResource: "Defaults", ofType: "plist"),
let userDict = NSDictionary(contentsOfFile: path) as? [String: AnyObject] {
if (userDict["UserValues"] as? String) != nil {
defaults.set(["test": "test value"], forKey: "UserValues")
defaults.synchronize()
}
}
}