mirror of https://github.com/SnapKit/SnapKit
Fix up legacy deployment and availability of APIs
This commit is contained in:
parent
4715badfa0
commit
8fc933a5c2
|
@ -192,7 +192,7 @@ public class Constraint {
|
||||||
// add constraints
|
// add constraints
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY && (os(iOS) || os(tvOS))
|
#if SNAPKIT_DEPLOYMENT_LEGACY && (os(iOS) || os(tvOS))
|
||||||
if #available(iOS 8.0, *) {
|
if #available(iOS 8.0, *) {
|
||||||
NSLayoutConstraint.activateConstraints(newLayoutConstraints)
|
NSLayoutConstraint.activate(newLayoutConstraints)
|
||||||
} else {
|
} else {
|
||||||
installOnView?.addConstraints(newLayoutConstraints)
|
installOnView?.addConstraints(newLayoutConstraints)
|
||||||
}
|
}
|
||||||
|
@ -226,8 +226,8 @@ public class Constraint {
|
||||||
|
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX)
|
#if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX)
|
||||||
if #available(iOS 8.0, *) {
|
if #available(iOS 8.0, *) {
|
||||||
NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints)
|
NSLayoutConstraint.deactivate(installedLayoutConstraints)
|
||||||
} else if let installedOnView = installInfo.view {
|
} else if let installedOnView = installInfo?.view {
|
||||||
installedOnView.removeConstraints(installedLayoutConstraints)
|
installedOnView.removeConstraints(installedLayoutConstraints)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -240,12 +240,12 @@ public class Constraint {
|
||||||
|
|
||||||
internal func activateIfNeeded() {
|
internal func activateIfNeeded() {
|
||||||
guard self.installInfo != nil else {
|
guard self.installInfo != nil else {
|
||||||
let _ = self.installIfNeeded()
|
_ = self.installIfNeeded()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY
|
#if SNAPKIT_DEPLOYMENT_LEGACY
|
||||||
guard #available(iOS 8.0, OSX 10.10, *) else {
|
guard #available(iOS 8.0, OSX 10.10, *) else {
|
||||||
self.installIfNeeded()
|
_ = self.installIfNeeded()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,102 +30,116 @@
|
||||||
|
|
||||||
public extension ConstraintView {
|
public extension ConstraintView {
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_left: ConstraintItem { return self.snp.left }
|
public var snp_left: ConstraintItem { return self.snp.left }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_top: ConstraintItem { return self.snp.top }
|
public var snp_top: ConstraintItem { return self.snp.top }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_right: ConstraintItem { return self.snp.right }
|
public var snp_right: ConstraintItem { return self.snp.right }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_bottom: ConstraintItem { return self.snp.bottom }
|
public var snp_bottom: ConstraintItem { return self.snp.bottom }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_leading: ConstraintItem { return self.snp.leading }
|
public var snp_leading: ConstraintItem { return self.snp.leading }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_trailing: ConstraintItem { return self.snp.trailing }
|
public var snp_trailing: ConstraintItem { return self.snp.trailing }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_width: ConstraintItem { return self.snp.width }
|
public var snp_width: ConstraintItem { return self.snp.width }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_height: ConstraintItem { return self.snp.height }
|
public var snp_height: ConstraintItem { return self.snp.height }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_centerX: ConstraintItem { return self.snp.centerX }
|
public var snp_centerX: ConstraintItem { return self.snp.centerX }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_centerY: ConstraintItem { return self.snp.centerY }
|
public var snp_centerY: ConstraintItem { return self.snp.centerY }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_baseline: ConstraintItem { return self.snp.baseline }
|
public var snp_baseline: ConstraintItem { return self.snp.baseline }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
public var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
|
||||||
|
|
||||||
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
|
public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
|
public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_topMargin: ConstraintItem { return self.snp.topMargin }
|
public var snp_topMargin: ConstraintItem { return self.snp.topMargin }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
|
public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
|
public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
|
public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
|
public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
|
public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
|
public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_edges: ConstraintItem { return self.snp.edges }
|
public var snp_edges: ConstraintItem { return self.snp.edges }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_size: ConstraintItem { return self.snp.size }
|
public var snp_size: ConstraintItem { return self.snp.size }
|
||||||
|
|
||||||
@available(*, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var snp_center: ConstraintItem { return self.snp.center }
|
public var snp_center: ConstraintItem { return self.snp.center }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_margins: ConstraintItem { return self.snp.margins }
|
public var snp_margins: ConstraintItem { return self.snp.margins }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
|
@available(iOS 8.0, *)
|
||||||
public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
|
public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public func snp_prepareConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) -> [Constraint] {
|
public func snp_prepareConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
return self.snp.prepareConstraints(closure)
|
return self.snp.prepareConstraints(closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public func snp_makeConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
|
public func snp_makeConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
|
||||||
self.snp.makeConstraints(closure)
|
self.snp.makeConstraints(closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public func snp_remakeConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
|
public func snp_remakeConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
|
||||||
self.snp.remakeConstraints(closure)
|
self.snp.remakeConstraints(closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public func snp_updateConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
|
public func snp_updateConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
|
||||||
self.snp.updateConstraints(closure)
|
self.snp.updateConstraints(closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(*, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public func snp_removeConstraints() {
|
public func snp_removeConstraints() {
|
||||||
self.snp.removeConstraints()
|
self.snp.removeConstraints()
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,22 +27,22 @@
|
||||||
|
|
||||||
public extension ConstraintViewController {
|
public extension ConstraintViewController {
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var topLayoutGuideTop: ConstraintItem {
|
public var topLayoutGuideTop: ConstraintItem {
|
||||||
return self.snp.topLayoutGuideTop
|
return self.snp.topLayoutGuideTop
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var topLayoutGuideBottom: ConstraintItem {
|
public var topLayoutGuideBottom: ConstraintItem {
|
||||||
return self.snp.topLayoutGuideBottom
|
return self.snp.topLayoutGuideBottom
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var bottomLayoutGuideTop: ConstraintItem {
|
public var bottomLayoutGuideTop: ConstraintItem {
|
||||||
return self.snp.bottomLayoutGuideTop
|
return self.snp.bottomLayoutGuideTop
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use newer snp.* syntax.")
|
@available(iOS, deprecated:0.40.0, message:"Please use newer snp.* syntax.")
|
||||||
public var bottomLayoutGuideBottom: ConstraintItem {
|
public var bottomLayoutGuideBottom: ConstraintItem {
|
||||||
return self.snp.bottomLayoutGuideBottom
|
return self.snp.bottomLayoutGuideBottom
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,16 +70,17 @@ public struct ConstraintViewDSL {
|
||||||
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterY)
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterY)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS, deprecated:0.30.0, message:"Please use migrated .lastBaseline")
|
@available(*, deprecated:0.40.0, message:"Please use migrated .lastBaseline")
|
||||||
public var baseline: ConstraintItem {
|
public var baseline: ConstraintItem {
|
||||||
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Baseline)
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Baseline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
public var lastBaseline: ConstraintItem {
|
public var lastBaseline: ConstraintItem {
|
||||||
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Baseline)
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Baseline)
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, OSX 10.11, *)
|
||||||
public var firstBaseline: ConstraintItem {
|
public var firstBaseline: ConstraintItem {
|
||||||
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.FirstBaseline)
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.FirstBaseline)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue