import Cocoa
import SDWebImage
class ViewController: NSViewController {
@IBOutlet weak var imageButton: NSButton!
override func viewDidLoad() {
super.viewDidLoad()
SDWebImageManager.shared.loadImage(with: URL(fileURLWithPath: "/Users/ikeh/Downloads/ImageSample/giphy.gif"), options: [], progress: nil) { loadedImage, _, _, _, _, _ in
guard let loadedImage = loadedImage else { return }
let animatedImageView = SDAnimatedImageView(image: loadedImage)
animatedImageView.animates = true
self.imageButton.addSubview(animatedImageView)
animatedImageView.anchor(top: self.imageButton.topAnchor, left: self.imageButton.leftAnchor, right: self.imageButton.rightAnchor, bottom: self.imageButton.bottomAnchor, paddingTop: 2, paddingLeft: 2, paddingRight: 2, paddingBottom: 2)
}
}
@IBAction func imageButtonClicked(_ sender: Any) {
print("imageButtonClicked")
}
}