             #if os(iOS) || os(tvOS)
             imageView.layer.removeAllAnimations()
             #elseif os(macOS)
-            imageView.layer?.removeAllAnimations()
+            let layer = (imageView as? NSView)?.layer ?? imageView.layer
+            layer?.removeAllAnimations()
             #endif
         }
 

@objc public protocol Nuke_ImageDisplaying {
    /// Display a given image.
    @objc func nuke_display(image: PlatformImage?)
}

#if os(iOS) || os(tvOS)
import UIKit

import Cocoa
/// An `NSObject` that implements `ImageDisplaying`  and `Animating` protocols.
/// Can support `NSView` and `NSCell`. The latter can return nil for layer.
public typealias ImageDisplayingView = NSObject & Nuke_ImageDisplaying

extension NSImageView: Nuke_ImageDisplaying {
    /// Displays an image.
