Class 'ViewController' hat keine Initialisierer in swift
Die Beschwerde vom Compiler erhalten, wenn ich das tue
class ViewController: UIViewController {
var delegate : AppDelegate
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//self.appDelegate = UIApplication.sharedApplication().delegate;
}
@IBAction func getData(sender : AnyObject) {
}
@IBAction func LogOut(sender : AnyObject) {
}
}
Allerdings, wenn ich nur @ hinzufüg? am Ende von AppDelegate wie unten und der Fehler ist weg.
class ViewController: UIViewController {
var delegate : AppDelegate?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//self.appDelegate = UIApplication.sharedApplication().delegate;
}
@IBAction func getData(sender : AnyObject) {
}
@IBAction func LogOut(sender : AnyObject) {
}
}
Ich sehe nichtoptional
Keyword, das für diesen Fehler relevant ist, sofern ich mich nicht irre.