Skip to content

Commit

Permalink
Merge pull request #150 from layoutBox/improve_autocomplete
Browse files Browse the repository at this point in the history
Fix Xcode autocomplete
  • Loading branch information
lucdion authored Jun 20, 2018
2 parents 07051b3 + 8b8f9ab commit 9c9c148
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
17 changes: 12 additions & 5 deletions Sources/Extensions/NSView+PinLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ import AppKit
extension NSView: Layoutable {
public typealias View = NSView

public var pin: PinLayout<NSView> {
return PinLayout(view: self, keepTransform: true)
}

public var pinFrame: PinLayout<NSView> {
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
Expand Down Expand Up @@ -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 {
Expand Down
17 changes: 12 additions & 5 deletions Sources/Extensions/UIView+PinLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ import UIKit
extension UIView: Layoutable, SizeCalculable {
public typealias View = UIView

public var pin: PinLayout<UIView> {
return PinLayout(view: self, keepTransform: true)
}

public var pinFrame: PinLayout<UIView> {
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 {
/*
Expand Down Expand Up @@ -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
8 changes: 0 additions & 8 deletions Sources/Layoutable+PinLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
import Foundation

extension Layoutable {
public var pin: PinLayout<View> {
return PinLayout(view: self as! Self.View, keepTransform: true)
}

public var pinFrame: PinLayout<View> {
return PinLayout(view: self as! Self.View, keepTransform: false)
}

public var anchor: AnchorList {
return AnchorListImpl(view: self as! View)
}
Expand Down

0 comments on commit 9c9c148

Please sign in to comment.