Binding ImageView to Asset Catalogue

51 views Asked by At

I have a NSTableView bound to myArrayController, controlling an object that looks a bit like this

class myObject: NSObject {
    @objc  var name: String
    @objc  var image: String
}

In my tableview, I have a column with an NSImageView, that I want to bind to the 'image' value of the associated object.

In my Assets.xcassets library, I have imagesets.

Now this is where my knowledge stops.

For the binding, I have 3 options

  • value
  • valuepath
  • valueUrl

just passing a string corresponding to the name of an image set to either of these options doesn't work.

So, I guess I need to use a Value Transformer, but I haven't got a clue on how to set that up.

Your help is very much appreciated

BTW, this is all MacOS/Swift

0

There are 0 answers