Add availability check for iOS 8 attributes.

This commit is contained in:
Suyeol Jeon 2015-09-14 22:31:55 +09:00
parent 1754ffd536
commit 8e6219ef86
1 changed files with 28 additions and 26 deletions

View File

@ -125,32 +125,34 @@ internal struct ConstraintAttributes: OptionSetType, BooleanType {
attrs.append(.Baseline) attrs.append(.Baseline)
} }
#if os(iOS) #if os(iOS)
if (self.contains(ConstraintAttributes.FirstBaseline)) { if #available(iOS 8.0, *) {
attrs.append(.FirstBaseline) if (self.contains(ConstraintAttributes.FirstBaseline)) {
} attrs.append(.FirstBaseline)
if (self.contains(ConstraintAttributes.LeftMargin)) { }
attrs.append(.LeftMargin) if (self.contains(ConstraintAttributes.LeftMargin)) {
} attrs.append(.LeftMargin)
if (self.contains(ConstraintAttributes.RightMargin)) { }
attrs.append(.RightMargin) if (self.contains(ConstraintAttributes.RightMargin)) {
} attrs.append(.RightMargin)
if (self.contains(ConstraintAttributes.TopMargin)) { }
attrs.append(.TopMargin) if (self.contains(ConstraintAttributes.TopMargin)) {
} attrs.append(.TopMargin)
if (self.contains(ConstraintAttributes.BottomMargin)) { }
attrs.append(.BottomMargin) if (self.contains(ConstraintAttributes.BottomMargin)) {
} attrs.append(.BottomMargin)
if (self.contains(ConstraintAttributes.LeadingMargin)) { }
attrs.append(.LeadingMargin) if (self.contains(ConstraintAttributes.LeadingMargin)) {
} attrs.append(.LeadingMargin)
if (self.contains(ConstraintAttributes.TrailingMargin)) { }
attrs.append(.TrailingMargin) if (self.contains(ConstraintAttributes.TrailingMargin)) {
} attrs.append(.TrailingMargin)
if (self.contains(ConstraintAttributes.CenterXWithinMargins)) { }
attrs.append(.CenterXWithinMargins) if (self.contains(ConstraintAttributes.CenterXWithinMargins)) {
} attrs.append(.CenterXWithinMargins)
if (self.contains(ConstraintAttributes.CenterYWithinMargins)) { }
attrs.append(.CenterYWithinMargins) if (self.contains(ConstraintAttributes.CenterYWithinMargins)) {
attrs.append(.CenterYWithinMargins)
}
} }
#endif #endif
return attrs return attrs