From 4bd29e82fb0c25db9da7bee267a8d6e02f82f44f Mon Sep 17 00:00:00 2001 From: Yuki Nagai Date: Mon, 29 Aug 2016 15:23:22 +0900 Subject: [PATCH] Make ConstraintDescription.constraint lazy --- Source/ConstraintDescription.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ConstraintDescription.swift b/Source/ConstraintDescription.swift index 6eae505..d961fb5 100644 --- a/Source/ConstraintDescription.swift +++ b/Source/ConstraintDescription.swift @@ -39,7 +39,7 @@ public class ConstraintDescription { internal var multiplier: ConstraintMultiplierTarget = 1.0 internal var constant: ConstraintConstantTarget = 0.0 internal var priority: ConstraintPriorityTarget = 1000.0 - internal var constraint: Constraint? { + internal lazy var constraint: Constraint? = { guard let relation = self.relation, let related = self.related, let sourceLocation = self.sourceLocation else { @@ -57,7 +57,7 @@ public class ConstraintDescription { constant: self.constant, priority: self.priority ) - } + }() // MARK: Initialization