Merge branch 'develop' of github.com:SnapKit/SnapKit into develop

This commit is contained in:
Robert Payne 2016-12-26 00:37:52 +13:00
commit 3838029c66
3 changed files with 15 additions and 10 deletions

View File

@ -57,6 +57,9 @@ public class ConstraintMakerRelatable {
} else if let other = other as? ConstraintConstantTarget {
related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)
constant = other
} else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide {
related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
constant = 0.0
} else {
fatalError("Invalid constraint. (\(file), \(line))")
}

View File

@ -60,3 +60,7 @@ extension ConstraintItem: ConstraintRelatableTarget {
extension ConstraintView: ConstraintRelatableTarget {
}
@available(iOS 9.0, OSX 10.11, *)
extension ConstraintLayoutGuide: ConstraintRelatableTarget {
}

View File

@ -60,16 +60,16 @@ class SnapKitTests: XCTestCase {
}
#if os(iOS) || os(tvOS)
func testGuideMakeConstraints() {
guard #available(iOS 9.0, *) else { return }
guard #available(iOS 9.0, OSX 10.11, *) else { return }
let v1 = View()
let g1 = UILayoutGuide()
let g1 = ConstraintLayoutGuide()
self.container.addSubview(v1)
self.container.addLayoutGuide(g1)
v1.snp.makeConstraints { (make) -> Void in
make.top.equalTo(g1.snp.top).offset(50)
make.top.equalTo(g1).offset(50)
make.left.equalTo(g1.snp.top).offset(50)
return
}
@ -83,7 +83,6 @@ class SnapKitTests: XCTestCase {
XCTAssertEqual(self.container.snp_constraints.count, 6, "Should have 6 constraints installed")
}
#endif
func testMakeImpliedSuperviewConstraints() {
let v1 = View()
@ -130,7 +129,6 @@ class SnapKitTests: XCTestCase {
}
func testRemakeConstraints() {
let v1 = View()
let v2 = View()