For Item to automatically be Codable, you need to make sure that each element (id, name, and image) is Codable. If you can ensure that, the compiler will automatically implement necessary functions for you. See Encoding and Decoding Custom Types.
However, UIImage is not Codable (you can't put an image in a JSON, for one), so the compiler can't create the necessary part for you.
Now, you're trying to treat Item as a JSON object judging from UserDefaults.saveItems you implemented, so it'd make sense for Item to be codable.
On how to store the images as JSON object, it depends on what those images are. As said earlier, JSON doesn't have an image object.
If you can identify the image with something else, like a name, you can instead store the name of the image.
You can also store image as a separate file, and use the URL to that file when saving to UserDefault.
You can also convert the images to the raw bytes of data, and then store them with some string encoding, like base64 for which Data has a convenient conversion function–Data. base64EncodedString(options:).*
That said, this is getting into iOS territory about how to persistently store image. If you have further question in that direction, I'd suggest that you ask over Apple Developer Forums instead.
* I actually wouldn't recommend storing large amount of data, like an entire image in the UserDefault. It'll likely slow down your application significantly.
Codable is used to encoder data to json, and decoder data from json, generally we store basic data with json, like string, bool, number and so on.
If you want to store image, you'd better store the image path or image name in your database, then store image files in a cache folder, like ' FileManager.SearchPathDirectory.cachesDirectory', when you want to read your image, get it from your folder with image name.
Unfortunately, no. I'm not too well-versed in the UIImagePicker.
Though I can suggest a few things:
Try to remove unnecessary parts. Not a lot of people are willing to read a 100-line code just to tell you what's wrong.
Try to be more descriptive about what you'd expect, and what happened.
I see that you print inputImage at line 49, but I need to read the source code to see that. And I still don't see what's wrong, it must be nil there. We wouldn't be in the else case otherwise.