diff --git a/Sources/Extensions/NSView+PinLayout.swift b/Sources/Extensions/NSView+PinLayout.swift index 5d85ea25..27473998 100644 --- a/Sources/Extensions/NSView+PinLayout.swift +++ b/Sources/Extensions/NSView+PinLayout.swift @@ -25,6 +25,18 @@ import AppKit extension NSView: Layoutable { public typealias View = NSView + public var pin: PinLayout { + return PinLayout(view: self, keepTransform: true) + } + + public var pinFrame: PinLayout { + return PinLayout(view: self, keepTransform: false) + } + + @objc public var pinObjc: PinLayoutObjC { + return PinLayoutObjCImpl(view: self, keepTransform: true) + } + public func getRect(keepTransform: Bool) -> CGRect { if let superview = superview, !superview.isFlipped { var flippedRect = frame @@ -54,11 +66,6 @@ extension NSView: Layoutable { case .rtl: return false } } - - // Expose PinLayout's objective-c interface. - @objc public var pinObjc: PinLayoutObjC { - return PinLayoutObjCImpl(view: self, keepTransform: true) - } } extension NSControl: SizeCalculable { diff --git a/Sources/Extensions/UIView+PinLayout.swift b/Sources/Extensions/UIView+PinLayout.swift index 35bc2ab9..7ca675d2 100644 --- a/Sources/Extensions/UIView+PinLayout.swift +++ b/Sources/Extensions/UIView+PinLayout.swift @@ -25,6 +25,18 @@ import UIKit extension UIView: Layoutable, SizeCalculable { public typealias View = UIView + public var pin: PinLayout { + return PinLayout(view: self, keepTransform: true) + } + + public var pinFrame: PinLayout { + return PinLayout(view: self, keepTransform: false) + } + + @objc public var pinObjc: PinLayoutObjC { + return PinLayoutObjCImpl(view: self, keepTransform: true) + } + public func getRect(keepTransform: Bool) -> CGRect { if keepTransform { /* @@ -79,11 +91,6 @@ extension UIView: Layoutable, SizeCalculable { case .rtl: return false } } - - // Expose PinLayout's objective-c interface. - @objc public var pinObjc: PinLayoutObjC { - return PinLayoutObjCImpl(view: self, keepTransform: true) - } } #endif diff --git a/Sources/Layoutable+PinLayout.swift b/Sources/Layoutable+PinLayout.swift index a43b4642..63120fbc 100644 --- a/Sources/Layoutable+PinLayout.swift +++ b/Sources/Layoutable+PinLayout.swift @@ -9,14 +9,6 @@ import Foundation extension Layoutable { - public var pin: PinLayout { - return PinLayout(view: self as! Self.View, keepTransform: true) - } - - public var pinFrame: PinLayout { - return PinLayout(view: self as! Self.View, keepTransform: false) - } - public var anchor: AnchorList { return AnchorListImpl(view: self as! View) }