0

I'm getting g an error when inserting var item = Item?() in the ViewController.swift file. The error says, "Cannot invoke initializer for type item with no arguments. what should I do?

17th Sep 2016, 10:36 PM
Samuel A Oden
Samuel A Oden - avatar
3 ответов
0
maybe you forgot to put the argument inside the () ? like var item = Item?(someInt: 123)
18th Sep 2016, 11:53 PM
Nplus Chang
Nplus Chang - avatar
0
I thought there wasn't suppose to be one. that's what the '?' was for if the value was nil.
19th Sep 2016, 4:37 AM
Samuel A Oden
Samuel A Oden - avatar
0
Try var item: Item?
25th Sep 2016, 6:35 PM
Viktor Svensson
Viktor Svensson - avatar