From e84f9bc1c32402a5a5fc8fb993a6bdc0a6751951 Mon Sep 17 00:00:00 2001 From: Tadeas Kriz Date: Sun, 4 Oct 2015 23:17:48 +0200 Subject: [PATCH] Add compiler condition to remove warnings when not using legacy deployment. --- Source/Constraint.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Constraint.swift b/Source/Constraint.swift index 2f4b1c9..c7ae413 100644 --- a/Source/Constraint.swift +++ b/Source/Constraint.swift @@ -315,11 +315,15 @@ internal class ConcreteConstraint: Constraint { } // add constraints - if #available(iOS 8.0, OSX 10.7, *) { + #if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX) + if #available(iOS 8.0, *) { NSLayoutConstraint.activateConstraints(newLayoutConstraints) } else { installOnView!.addConstraints(newLayoutConstraints) } + #else + NSLayoutConstraint.activateConstraints(newLayoutConstraints) + #endif // set install info self.installInfo = ConcreteConstraintInstallInfo(view: installOnView, layoutConstraints: NSHashTable.weakObjectsHashTable()) @@ -342,11 +346,15 @@ internal class ConcreteConstraint: Constraint { if installedLayoutConstraints.count > 0 { // remove the constraints from the UIView's storage - if #available(iOS 8, OSX 10.7, *) { + #if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX) + if #available(iOS 8.0, *) { NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints) } else if let installedOnView = installInfo.view { installedOnView.removeConstraints(installedLayoutConstraints) } + #else + NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints) + #endif // remove the constraints from the from item view if let fromView = self.fromItem.view {