Skip to content

Commit 9c9c148

Browse files
authored
Merge pull request #150 from layoutBox/improve_autocomplete
Fix Xcode autocomplete
2 parents 07051b3 + 8b8f9ab commit 9c9c148

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

Sources/Extensions/NSView+PinLayout.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ import AppKit
2525
extension NSView: Layoutable {
2626
public typealias View = NSView
2727

28+
public var pin: PinLayout<NSView> {
29+
return PinLayout(view: self, keepTransform: true)
30+
}
31+
32+
public var pinFrame: PinLayout<NSView> {
33+
return PinLayout(view: self, keepTransform: false)
34+
}
35+
36+
@objc public var pinObjc: PinLayoutObjC {
37+
return PinLayoutObjCImpl(view: self, keepTransform: true)
38+
}
39+
2840
public func getRect(keepTransform: Bool) -> CGRect {
2941
if let superview = superview, !superview.isFlipped {
3042
var flippedRect = frame
@@ -54,11 +66,6 @@ extension NSView: Layoutable {
5466
case .rtl: return false
5567
}
5668
}
57-
58-
// Expose PinLayout's objective-c interface.
59-
@objc public var pinObjc: PinLayoutObjC {
60-
return PinLayoutObjCImpl(view: self, keepTransform: true)
61-
}
6269
}
6370

6471
extension NSControl: SizeCalculable {

Sources/Extensions/UIView+PinLayout.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ import UIKit
2525
extension UIView: Layoutable, SizeCalculable {
2626
public typealias View = UIView
2727

28+
public var pin: PinLayout<UIView> {
29+
return PinLayout(view: self, keepTransform: true)
30+
}
31+
32+
public var pinFrame: PinLayout<UIView> {
33+
return PinLayout(view: self, keepTransform: false)
34+
}
35+
36+
@objc public var pinObjc: PinLayoutObjC {
37+
return PinLayoutObjCImpl(view: self, keepTransform: true)
38+
}
39+
2840
public func getRect(keepTransform: Bool) -> CGRect {
2941
if keepTransform {
3042
/*
@@ -79,11 +91,6 @@ extension UIView: Layoutable, SizeCalculable {
7991
case .rtl: return false
8092
}
8193
}
82-
83-
// Expose PinLayout's objective-c interface.
84-
@objc public var pinObjc: PinLayoutObjC {
85-
return PinLayoutObjCImpl(view: self, keepTransform: true)
86-
}
8794
}
8895

8996
#endif

Sources/Layoutable+PinLayout.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
import Foundation
1010

1111
extension Layoutable {
12-
public var pin: PinLayout<View> {
13-
return PinLayout(view: self as! Self.View, keepTransform: true)
14-
}
15-
16-
public var pinFrame: PinLayout<View> {
17-
return PinLayout(view: self as! Self.View, keepTransform: false)
18-
}
19-
2012
public var anchor: AnchorList {
2113
return AnchorListImpl(view: self as! View)
2214
}

0 commit comments

Comments
 (0)