Fix up iOS 9 / OSX 10.11 availability on Layout Guides

This commit is contained in:
Robert Payne 2016-10-11 23:17:32 +13:00
parent 6312572419
commit cfa5e8cb5b
5 changed files with 10 additions and 9 deletions

View File

@ -38,7 +38,7 @@
EECDB3931AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; }; EECDB3931AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
EEF68F9E1D78492400980C26 /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68F9D1D78492400980C26 /* ConstraintLayoutGuideDSL.swift */; }; EEF68F9E1D78492400980C26 /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68F9D1D78492400980C26 /* ConstraintLayoutGuideDSL.swift */; };
EEF68FA61D784A5300980C26 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FA51D784A5300980C26 /* ConstraintDSL.swift */; }; EEF68FA61D784A5300980C26 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FA51D784A5300980C26 /* ConstraintDSL.swift */; };
EEF68FB01D784FB100980C26 /* UILayoutGuide+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FAF1D784FB100980C26 /* UILayoutGuide+Extensions.swift */; }; EEF68FB01D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FAF1D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift */; };
EEF68FB41D784FBA00980C26 /* UILayoutSupport+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */; }; EEF68FB41D784FBA00980C26 /* UILayoutSupport+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */; };
EEF68FBC1D78653000980C26 /* ConstraintLayoutGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FBB1D78653000980C26 /* ConstraintLayoutGuide.swift */; }; EEF68FBC1D78653000980C26 /* ConstraintLayoutGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FBB1D78653000980C26 /* ConstraintLayoutGuide.swift */; };
EEF68FC01D7865AA00980C26 /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FBF1D7865AA00980C26 /* ConstraintLayoutSupport.swift */; }; EEF68FC01D7865AA00980C26 /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF68FBF1D7865AA00980C26 /* ConstraintLayoutSupport.swift */; };
@ -82,7 +82,7 @@
EECDB36A1AC0C95C006BBC11 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; }; EECDB36A1AC0C95C006BBC11 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
EEF68F9D1D78492400980C26 /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutGuideDSL.swift; sourceTree = "<group>"; }; EEF68F9D1D78492400980C26 /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutGuideDSL.swift; sourceTree = "<group>"; };
EEF68FA51D784A5300980C26 /* ConstraintDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDSL.swift; sourceTree = "<group>"; }; EEF68FA51D784A5300980C26 /* ConstraintDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDSL.swift; sourceTree = "<group>"; };
EEF68FAF1D784FB100980C26 /* UILayoutGuide+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILayoutGuide+Extensions.swift"; sourceTree = "<group>"; }; EEF68FAF1D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConstraintLayoutGuide+Extensions.swift"; sourceTree = "<group>"; };
EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILayoutSupport+Extensions.swift"; sourceTree = "<group>"; }; EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILayoutSupport+Extensions.swift"; sourceTree = "<group>"; };
EEF68FBB1D78653000980C26 /* ConstraintLayoutGuide.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutGuide.swift; sourceTree = "<group>"; }; EEF68FBB1D78653000980C26 /* ConstraintLayoutGuide.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutGuide.swift; sourceTree = "<group>"; };
EEF68FBF1D7865AA00980C26 /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutSupport.swift; sourceTree = "<group>"; }; EEF68FBF1D7865AA00980C26 /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutSupport.swift; sourceTree = "<group>"; };
@ -129,7 +129,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */, EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */,
EEF68FAF1D784FB100980C26 /* UILayoutGuide+Extensions.swift */, EEF68FAF1D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift */,
EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */, EEF68FB31D784FBA00980C26 /* UILayoutSupport+Extensions.swift */,
); );
name = Extensions; name = Extensions;
@ -371,7 +371,7 @@
EE235F881C5785C600C08960 /* ConstraintItem.swift in Sources */, EE235F881C5785C600C08960 /* ConstraintItem.swift in Sources */,
EE235F9A1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */, EE235F9A1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */,
EEF68FC01D7865AA00980C26 /* ConstraintLayoutSupport.swift in Sources */, EEF68FC01D7865AA00980C26 /* ConstraintLayoutSupport.swift in Sources */,
EEF68FB01D784FB100980C26 /* UILayoutGuide+Extensions.swift in Sources */, EEF68FB01D784FB100980C26 /* ConstraintLayoutGuide+Extensions.swift in Sources */,
EE235F761C5785C600C08960 /* ConstraintConfig.swift in Sources */, EE235F761C5785C600C08960 /* ConstraintConfig.swift in Sources */,
EE235F6D1C5785C600C08960 /* Constraint.swift in Sources */, EE235F6D1C5785C600C08960 /* Constraint.swift in Sources */,
EE235F791C5785C600C08960 /* ConstraintView.swift in Sources */, EE235F791C5785C600C08960 /* ConstraintView.swift in Sources */,

View File

@ -26,7 +26,7 @@
#endif #endif
@available(iOS 9.0, *) @available(iOS 9.0, OSX 10.11, *)
public extension ConstraintLayoutGuide { public extension ConstraintLayoutGuide {
public var snp: ConstraintLayoutGuideDSL { public var snp: ConstraintLayoutGuideDSL {

View File

@ -32,5 +32,6 @@
@available(iOS 9.0, *) @available(iOS 9.0, *)
public typealias ConstraintLayoutGuide = UILayoutGuide public typealias ConstraintLayoutGuide = UILayoutGuide
#else #else
public class ConstraintLayoutGuide {} @available(OSX 10.11, *)
public typealias ConstraintLayoutGuide = NSLayoutGuide
#endif #endif

View File

@ -28,7 +28,7 @@
#endif #endif
@available(iOS 9.0, *) @available(iOS 9.0, OSX 10.11, *)
public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL { public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL {
@discardableResult @discardableResult

View File

@ -31,7 +31,7 @@
public protocol LayoutConstraintItem: class { public protocol LayoutConstraintItem: class {
} }
@available(iOS 9.0, *) @available(iOS 9.0, OSX 10.11, *)
extension ConstraintLayoutGuide : LayoutConstraintItem { extension ConstraintLayoutGuide : LayoutConstraintItem {
} }
@ -52,7 +52,7 @@ extension LayoutConstraintItem {
return view.superview return view.superview
} }
if #available(iOS 9.0, *), let guide = self as? ConstraintLayoutGuide { if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide {
return guide.owningView return guide.owningView
} }