Swift Partern
// Singleton
static let sharedInstance = SingletonA()
// The KVO mechanism allows an object to observe changes to a property.
// In your case, you can use KVO to observe changes to the image property of the UIImageView that holds the image.
init {
object.addObserver(self, forKeyPath: "objectProperty", options: nil, context: nil)
}
deinit {
object.removeObserver(self, forKeyPath: "objectProperty")
}
override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
if keyPath == "objectProperty" {
//do something
}
}