diff --git a/Source/Constraint.swift b/Source/Constraint.swift index c923ad2..184b454 100644 --- a/Source/Constraint.swift +++ b/Source/Constraint.swift @@ -58,7 +58,7 @@ public class Constraint { public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") } public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") } - public func nativeConstraints() -> [LayoutConstraint] { fatalError("Must be implemented by Concrete subclass.") } + public var layoutConstraints: [LayoutConstraint] { fatalError("Must be implemented by Concrete subclass.") } internal var makerFile: String = "Unknown" internal var makerLine: UInt = 0 @@ -199,7 +199,7 @@ internal class ConcreteConstraint: Constraint { private var installInfo: ConcreteConstraintInstallInfo? = nil - internal override func nativeConstraints() -> [LayoutConstraint] { + override var layoutConstraints: [LayoutConstraint] { if installInfo == nil { install() } diff --git a/Tests/Tests.swift b/Tests/Tests.swift index debf790..d317194 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -302,10 +302,10 @@ class SnapKitTests: XCTestCase { var sizeNativeConstraints: [LayoutConstraint]! view.snp_makeConstraints { (make) -> Void in let topConstraint = make.top.equalToSuperview().inset(10).constraint - topNativeConstraints = topConstraint.nativeConstraints() - topNativeConstraint = topConstraint.nativeConstraints().first + topNativeConstraints = topConstraint.layoutConstraints + topNativeConstraint = topConstraint.layoutConstraints.first let sizeConstraints = make.size.equalTo(50).constraint - sizeNativeConstraints = sizeConstraints.nativeConstraints() + sizeNativeConstraints = sizeConstraints.layoutConstraints } XCTAssertEqual(topNativeConstraints.count, 1, "make.top should creates one native constraint")