`ref1Array` has default argument `= []`. That's why you don't need to supply argument.Also, initializing `@State` only works the first, the next time you access the view, it'll retain the old state, even if you supply different argument.If that's not what you want, use normal `let` instead.
Post
Replies
Boosts
Views
Activity
Right, if you have implemented initializers, Swift will not generate member-wise one for you (which also answers your previous response, so I'm not gonna reply to that).Also, the arguments in the memberwise follow initializer follows the variable's access control. If you have private variable, you can only specify it with private initializer, not from different file.Could you also elaborate the "work as expected" version? If you change var to let, you can't supply it as an argument, which iirc, is not what you want.PSI'd suggest that you try to make the code as small as possible when asking. It's not easy looking through 300+ lines of code just to reply to a forum, especially when a large part of them is irrelevant. Like this one, the only important thing is that you don't have the initializer you want. You may want to create new playground to experiment the rule surrounding initializer using a mock class (like Foo). You may even figure it out on your own by doing that. And if your question pertains only the swift language, not particular framework, you may want to try http://forums.swift.org
Now that I checked the imagePickerController(_:didFinishPickingMediaWithInfo:). The info should actually be [UIImagePickerController.InfoKey: Any], not [UIImagePickerController.InfoKey: String]. So that could be where things get weird since you're not matching the type between the ObjC requirement with Swift function.
Also, info[.originalImage] is an UIImage, not String?. Likely you had type mismatch, and the interop with ObjC just silence the error and change to nil.