I'd like to check if an image with the name "image.png"
is set to the image view "imgView"
. I know how I can do this with Swift in the normal ViewController.swift
but don't know how I can do this in the watch kit extension (InterfaceController.swift
). Does someone of you guys know how I can do this?
Check if image with name is set (WatchKit)
302 views Asked by Vpor At
1
Looking at the header for WKInterfaceImage:
The API only has setters and no getters. One strategy might be to subclass this and track the setting, and write your own custom getters, but unfortunately you can't change to a custom class in the storyboard, so you can't use that custom subclass anyway. You'd also be unable to programmatically read images that were set from the storyboard directly.
But to answer your question, you can't ask WKInterfaceImage what image it has. The only way would be to track what images you're setting manually like this: