rename 'nativeConstraints' to 'layoutConstraints' for API consistency

This commit is contained in:
Colin T.A. Gray 2016-06-21 16:01:26 -06:00
parent f46a31dc83
commit 4a9522a4ae
2 changed files with 5 additions and 5 deletions

View File

@ -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()
}

View File

@ -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")