Good morning , still confused on unwrapping . Have a wrapped
var catagory: Catagory? which gives the error
Cannot assign value of type ‘String’ to type ‘Catagory?’
for
subcatagory.catagory = selectedCatagory
I think the subcategory.catagory needs to be unwrapped to assign it the selectedCatagory from the Picker. I tried Let but can’t seem to get it .
Any advice is appreciated
Joel
This error has nothing to do with unwrapping an Optional
. It’s saying that the value you are assigning (selectedCatagory
) is a String
but the variable you are trying to assign it to (subcatagory.catagory
) is a Catagory?
. You cannot assign a String
value to a Catagory?
variable.
Thanks for the quick reply, just had to extend to subcatagory.catagory?.name = selectedCatagory to assign.