Group Group Group Group Group Group Group Group Group

Image Binding |

This is a companion discussion topic for the original entry at

This Image Binding tutorial will not work with the current XCode 12.1 (even though the tutorial came out after this version of XCode).

The class Library needs to become an ObservableObject and uiImages needs to be marked with @Published:

final class Library: ObservableObject {

@Published var uiImages: [Book: UIImage] = [:]

Then the library variable in ContentView in ContentView.swift needs to be changed from @State to @StateObject

struct ContentView: View {
@StateObject var library = Library()

Your list in ContentView and DetailView will then update with the image that has been selected.

I just tested the uploaded materials again, with no problems. What you’ve shown here doesn’t solve any problem that exists at this point in the course. Please upload your version of the project without using a model object, and I’ll have a look!

(My guess is that your Library is a class, instead of a struct.)

You are correct that I was using a class-not a struct-which was causing the problem. If you skip ahead to your supplied Starter and Final projects for 12-image-binding your version of Library uses a struct and the project works fine.

Unfortunately, I have worked through your projects in order and have carefully built my project from scratch with the exception of Library.swift which we added in 05-lists: in both the Starter and Final projects there, you have supplied a final class rather than a struct. Furthermore, your video actually shows Library.swift with a final class rather than a struct:
[Uploading: Library.swift screenshot.png.png…]
Hence the problem…

1 Like

Thanks for letting me know. I’ve updated the downloadable materials and added an Author Note for Episode 5.

I went through this tutorial a week or so ago, and was unable to get images from the picker to show up on the detail view or list view.

I went through it AGAIN tonight (from scratch) to make sure i hadn’t mistyped anything and I’m having the exact same issue.

I’m on xcode 12.2. I copy/pasted the library file contents into my project but otherwise started from scratch.


Please upload your project and I’ll have a look.

And the way I will make a comparison to the downloadable final project is by using Git. Highly recommended learning!

Hmm, it’s saying new user cannot upload attachments

I’d recommend pushing it to GitHub, or using Dropbox.

You are also using a class instead of a struct, as described earlier in this thread.