Skip to content

Commit ee34ec5

Browse files
committed
Merge branch 'develop' of github.com:SnapKit/SnapKit into develop
2 parents fa8d063 + 004d73a commit ee34ec5

13 files changed

+45
-22
lines changed

Source/Constraint.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit
@@ -119,7 +119,7 @@ internal class ConcreteConstraint: Constraint {
119119
self.updatePriority(Float(750.0))
120120
}
121121
internal override func updatePriorityMedium() -> Void {
122-
#if os(iOS)
122+
#if os(iOS) || os(tvOS)
123123
self.updatePriority(Float(500.0))
124124
#else
125125
self.updatePriority(Float(501.0))
@@ -251,7 +251,7 @@ internal class ConcreteConstraint: Constraint {
251251
let layoutConstant: CGFloat = layoutToAttribute.snp_constantForValue(self.constant)
252252

253253
// get layout to
254-
#if os(iOS)
254+
#if os(iOS) || os(tvOS)
255255
var layoutTo: AnyObject? = self.toItem.view ?? self.toItem.layoutSupport
256256
#else
257257
var layoutTo: AnyObject? = self.toItem.view
@@ -397,7 +397,7 @@ private extension NSLayoutAttribute {
397397
}
398398
// CGPoint
399399
else if let point = value as? CGPoint {
400-
#if os(iOS)
400+
#if os(iOS) || os(tvOS)
401401
switch self {
402402
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return point.x
403403
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return point.y
@@ -422,7 +422,7 @@ private extension NSLayoutAttribute {
422422
}
423423
// EdgeInsets
424424
else if let insets = value as? EdgeInsets {
425-
#if os(iOS)
425+
#if os(iOS) || os(tvOS)
426426
switch self {
427427
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return insets.left
428428
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return insets.top

Source/ConstraintAttributes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit
@@ -133,7 +133,7 @@ internal struct ConstraintAttributes: OptionSetType, BooleanType {
133133
attrs.append(.Baseline)
134134
}
135135

136-
#if os(iOS)
136+
#if os(iOS) || os(tvOS)
137137
#if SNAPKIT_DEPLOYMENT_LEGACY
138138
guard #available(iOS 8.0, *) else {
139139
return attrs

Source/ConstraintDescription.swift

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit
@@ -95,6 +95,8 @@ public protocol ConstraintDescriptionRelatable: class {
9595
func equalTo(other: View) -> ConstraintDescriptionEditable
9696
@available(iOS 7.0, *)
9797
func equalTo(other: LayoutSupport) -> ConstraintDescriptionEditable
98+
@available(iOS 9.0, *)
99+
func equalTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable
98100
func equalTo(other: Float) -> ConstraintDescriptionEditable
99101
func equalTo(other: Double) -> ConstraintDescriptionEditable
100102
func equalTo(other: CGFloat) -> ConstraintDescriptionEditable
@@ -108,6 +110,8 @@ public protocol ConstraintDescriptionRelatable: class {
108110
func lessThanOrEqualTo(other: View) -> ConstraintDescriptionEditable
109111
@available(iOS 7.0, *)
110112
func lessThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable
113+
@available(iOS 9.0, *)
114+
func lessThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable
111115
func lessThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable
112116
func lessThanOrEqualTo(other: Double) -> ConstraintDescriptionEditable
113117
func lessThanOrEqualTo(other: CGFloat) -> ConstraintDescriptionEditable
@@ -121,6 +125,8 @@ public protocol ConstraintDescriptionRelatable: class {
121125
func greaterThanOrEqualTo(other: View) -> ConstraintDescriptionEditable
122126
@available(iOS 7.0, *)
123127
func greaterThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable
128+
@available(iOS 9.0, *)
129+
func greaterThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable
124130
func greaterThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable
125131
func greaterThanOrEqualTo(other: Double) -> ConstraintDescriptionEditable
126132
func greaterThanOrEqualTo(other: CGFloat) -> ConstraintDescriptionEditable
@@ -224,6 +230,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
224230
internal func equalTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
225231
return self.constrainTo(other, relation: .Equal)
226232
}
233+
@available(iOS 9.0, *)
234+
internal func equalTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable {
235+
return self.constrainTo(other, relation: .Equal)
236+
}
227237
internal func equalTo(other: Float) -> ConstraintDescriptionEditable {
228238
return self.constrainTo(other, relation: .Equal)
229239
}
@@ -261,6 +271,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
261271
internal func lessThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
262272
return self.constrainTo(other, relation: .LessThanOrEqualTo)
263273
}
274+
@available(iOS 9.0, *)
275+
internal func lessThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable {
276+
return self.constrainTo(other, relation: .LessThanOrEqualTo)
277+
}
264278
internal func lessThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable {
265279
return self.constrainTo(other, relation: .LessThanOrEqualTo)
266280
}
@@ -298,6 +312,10 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
298312
internal func greaterThanOrEqualTo(other: LayoutSupport) -> ConstraintDescriptionEditable {
299313
return self.constrainTo(other, relation: .GreaterThanOrEqualTo)
300314
}
315+
@available(iOS 9.0, *)
316+
internal func greaterThanOrEqualTo(other: NSLayoutAnchor) -> ConstraintDescriptionEditable {
317+
return self.constrainTo(other, relation: .LessThanOrEqualTo)
318+
}
301319
internal func greaterThanOrEqualTo(other: Float) -> ConstraintDescriptionEditable {
302320
return self.constrainTo(other, relation: .GreaterThanOrEqualTo)
303321
}
@@ -446,7 +464,7 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
446464
return self.priority(750.0)
447465
}
448466
internal func priorityMedium() -> ConstraintDescriptionFinalizable {
449-
#if os(iOS)
467+
#if os(iOS) || os(tvOS)
450468
return self.priority(500.0)
451469
#else
452470
return self.priority(501.0)
@@ -547,6 +565,11 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
547565
return constrainTo(ConstraintItem(object: other, attributes: ConstraintAttributes.None), relation: relation)
548566
}
549567

568+
@available(iOS 9.0, *)
569+
private func constrainTo(other: NSLayoutAnchor, relation: ConstraintRelation) -> ConstraintDescription {
570+
return constrainTo(ConstraintItem(object: other, attributes: ConstraintAttributes.None), relation: relation)
571+
}
572+
550573
private func constrainTo(other: Float, relation: ConstraintRelation) -> ConstraintDescription {
551574
self.constant = other
552575
return constrainTo(ConstraintItem(object: nil, attributes: ConstraintAttributes.None), relation: relation)
@@ -571,4 +594,4 @@ internal class ConstraintDescription: ConstraintDescriptionExtendable, Constrain
571594
self.constant = other
572595
return constrainTo(ConstraintItem(object: nil, attributes: ConstraintAttributes.None), relation: relation)
573596
}
574-
}
597+
}

Source/ConstraintItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit

Source/ConstraintMaker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit

Source/ConstraintRelation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit

Source/Debugging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit
@@ -149,7 +149,7 @@ private extension NSLayoutRelation {
149149
private extension NSLayoutAttribute {
150150

151151
private var snp_description: String {
152-
#if os(iOS)
152+
#if os(iOS) || os(tvOS)
153153
switch self {
154154
case .NotAnAttribute: return "notAnAttribute"
155155
case .Top: return "top"

Source/EdgeInsets.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
public typealias EdgeInsets = UIEdgeInsets
2727
public func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets {

Source/LayoutConstraint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
#else
2727
import AppKit

Source/SnapKit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
#if os(iOS)
24+
#if os(iOS) || os(tvOS)
2525
import UIKit
2626
public typealias InterfaceLayoutDirection = UIUserInterfaceLayoutDirection
2727
public typealias LayoutSupport = UILayoutSupport

0 commit comments

Comments
 (0)