mirror of https://github.com/SnapKit/SnapKit
Major overhaul
This commit is contained in:
parent
82ac8f8f2f
commit
7ba532d597
|
@ -8,55 +8,101 @@
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
537DCE9B1C35CD4100B5B899 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 537DCE9A1C35CD4100B5B899 /* UIKit.framework */; };
|
537DCE9B1C35CD4100B5B899 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 537DCE9A1C35CD4100B5B899 /* UIKit.framework */; };
|
||||||
537DCE9C1C35CD9A00B5B899 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB35E1AC0C95C006BBC11 /* Constraint.swift */; };
|
|
||||||
537DCE9D1C35CDA300B5B899 /* SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF32E1AD926AE00A425FA /* SnapKit.swift */; };
|
|
||||||
537DCE9E1C35CDAA00B5B899 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF32B1AD910B900A425FA /* Debugging.swift */; };
|
|
||||||
537DCE9F1C35CDB700B5B899 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3601AC0C95C006BBC11 /* ConstraintItem.swift */; };
|
|
||||||
537DCEA01C35CDF800B5B899 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
537DCEA01C35CDF800B5B899 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
537DCEA11C35CE0000B5B899 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF3311AD9432400A425FA /* ConstraintDescription.swift */; };
|
|
||||||
537DCEA21C35CE0500B5B899 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3611AC0C95C006BBC11 /* ConstraintMaker.swift */; };
|
|
||||||
537DCEA31C35CE0900B5B899 /* View+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3671AC0C95C006BBC11 /* View+SnapKit.swift */; };
|
|
||||||
537DCEA41C35CE1500B5B899 /* ViewController+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */; };
|
|
||||||
537DCEA51C35CE1B00B5B899 /* EdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3631AC0C95C006BBC11 /* EdgeInsets.swift */; };
|
|
||||||
537DCEA61C35CE2000B5B899 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3651AC0C95C006BBC11 /* LayoutConstraint.swift */; };
|
|
||||||
537DCEA81C35CE3800B5B899 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3621AC0C95C006BBC11 /* ConstraintRelation.swift */; };
|
|
||||||
537DCEA91C35CE3E00B5B899 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB35F1AC0C95C006BBC11 /* ConstraintAttributes.swift */; };
|
|
||||||
537DCEAA1C35CE4800B5B899 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; };
|
|
||||||
537DCEB41C35D90A00B5B899 /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 537DCE921C35CC8800B5B899 /* SnapKit.framework */; };
|
537DCEB41C35D90A00B5B899 /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 537DCE921C35CC8800B5B899 /* SnapKit.framework */; };
|
||||||
537DCEBA1C35DA9700B5B899 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
|
537DCEBA1C35DA9700B5B899 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
|
||||||
779230441BCB6FC30027CF5F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; };
|
EE235F5F1C5785BC00C08960 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F5E1C5785BC00C08960 /* Debugging.swift */; };
|
||||||
779230451BCB6FC30027CF5F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779230431BCB6FC30027CF5F /* SourceLocation.swift */; };
|
EE235F601C5785BC00C08960 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F5E1C5785BC00C08960 /* Debugging.swift */; };
|
||||||
EE4910981B19A26000A54F1F /* ViewController+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */; };
|
EE235F611C5785BC00C08960 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F5E1C5785BC00C08960 /* Debugging.swift */; };
|
||||||
|
EE235F6D1C5785C600C08960 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F621C5785C600C08960 /* Constraint.swift */; };
|
||||||
|
EE235F6E1C5785C600C08960 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F621C5785C600C08960 /* Constraint.swift */; };
|
||||||
|
EE235F6F1C5785C600C08960 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F621C5785C600C08960 /* Constraint.swift */; };
|
||||||
|
EE235F701C5785C600C08960 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F631C5785C600C08960 /* ConstraintDescription.swift */; };
|
||||||
|
EE235F711C5785C600C08960 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F631C5785C600C08960 /* ConstraintDescription.swift */; };
|
||||||
|
EE235F721C5785C600C08960 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F631C5785C600C08960 /* ConstraintDescription.swift */; };
|
||||||
|
EE235F731C5785C600C08960 /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F641C5785C600C08960 /* ConstraintInsets.swift */; };
|
||||||
|
EE235F741C5785C600C08960 /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F641C5785C600C08960 /* ConstraintInsets.swift */; };
|
||||||
|
EE235F751C5785C600C08960 /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F641C5785C600C08960 /* ConstraintInsets.swift */; };
|
||||||
|
EE235F761C5785C600C08960 /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F651C5785C600C08960 /* ConstraintConfig.swift */; };
|
||||||
|
EE235F771C5785C600C08960 /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F651C5785C600C08960 /* ConstraintConfig.swift */; };
|
||||||
|
EE235F781C5785C600C08960 /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F651C5785C600C08960 /* ConstraintConfig.swift */; };
|
||||||
|
EE235F791C5785C600C08960 /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F661C5785C600C08960 /* ConstraintView.swift */; };
|
||||||
|
EE235F7A1C5785C600C08960 /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F661C5785C600C08960 /* ConstraintView.swift */; };
|
||||||
|
EE235F7B1C5785C600C08960 /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F661C5785C600C08960 /* ConstraintView.swift */; };
|
||||||
|
EE235F7C1C5785C600C08960 /* ConstraintViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F671C5785C600C08960 /* ConstraintViewController.swift */; };
|
||||||
|
EE235F7D1C5785C600C08960 /* ConstraintViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F671C5785C600C08960 /* ConstraintViewController.swift */; };
|
||||||
|
EE235F7E1C5785C600C08960 /* ConstraintViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F671C5785C600C08960 /* ConstraintViewController.swift */; };
|
||||||
|
EE235F7F1C5785C600C08960 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F681C5785C600C08960 /* ConstraintRelation.swift */; };
|
||||||
|
EE235F801C5785C600C08960 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F681C5785C600C08960 /* ConstraintRelation.swift */; };
|
||||||
|
EE235F811C5785C600C08960 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F681C5785C600C08960 /* ConstraintRelation.swift */; };
|
||||||
|
EE235F821C5785C600C08960 /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F691C5785C600C08960 /* ConstraintLayoutSupport.swift */; };
|
||||||
|
EE235F831C5785C600C08960 /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F691C5785C600C08960 /* ConstraintLayoutSupport.swift */; };
|
||||||
|
EE235F841C5785C600C08960 /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F691C5785C600C08960 /* ConstraintLayoutSupport.swift */; };
|
||||||
|
EE235F851C5785C600C08960 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6A1C5785C600C08960 /* ConstraintAttributes.swift */; };
|
||||||
|
EE235F861C5785C600C08960 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6A1C5785C600C08960 /* ConstraintAttributes.swift */; };
|
||||||
|
EE235F871C5785C600C08960 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6A1C5785C600C08960 /* ConstraintAttributes.swift */; };
|
||||||
|
EE235F881C5785C600C08960 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6B1C5785C600C08960 /* ConstraintItem.swift */; };
|
||||||
|
EE235F891C5785C600C08960 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6B1C5785C600C08960 /* ConstraintItem.swift */; };
|
||||||
|
EE235F8A1C5785C600C08960 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6B1C5785C600C08960 /* ConstraintItem.swift */; };
|
||||||
|
EE235F8B1C5785C600C08960 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6C1C5785C600C08960 /* LayoutConstraint.swift */; };
|
||||||
|
EE235F8C1C5785C600C08960 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6C1C5785C600C08960 /* LayoutConstraint.swift */; };
|
||||||
|
EE235F8D1C5785C600C08960 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F6C1C5785C600C08960 /* LayoutConstraint.swift */; };
|
||||||
|
EE235F941C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F8E1C5785CE00C08960 /* ConstraintRelatableTarget.swift */; };
|
||||||
|
EE235F951C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F8E1C5785CE00C08960 /* ConstraintRelatableTarget.swift */; };
|
||||||
|
EE235F961C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F8E1C5785CE00C08960 /* ConstraintRelatableTarget.swift */; };
|
||||||
|
EE235F971C5785CE00C08960 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F8F1C5785CE00C08960 /* ConstraintConstantTarget.swift */; };
|
||||||
|
EE235F981C5785CE00C08960 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F8F1C5785CE00C08960 /* ConstraintConstantTarget.swift */; };
|
||||||
|
EE235F991C5785CE00C08960 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F8F1C5785CE00C08960 /* ConstraintConstantTarget.swift */; };
|
||||||
|
EE235F9A1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F901C5785CE00C08960 /* ConstraintPriorityTarget.swift */; };
|
||||||
|
EE235F9B1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F901C5785CE00C08960 /* ConstraintPriorityTarget.swift */; };
|
||||||
|
EE235F9C1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F901C5785CE00C08960 /* ConstraintPriorityTarget.swift */; };
|
||||||
|
EE235F9D1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F911C5785CE00C08960 /* ConstraintMultiplierTarget.swift */; };
|
||||||
|
EE235F9E1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F911C5785CE00C08960 /* ConstraintMultiplierTarget.swift */; };
|
||||||
|
EE235F9F1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F911C5785CE00C08960 /* ConstraintMultiplierTarget.swift */; };
|
||||||
|
EE235FA01C5785CE00C08960 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F921C5785CE00C08960 /* ConstraintOffsetTarget.swift */; };
|
||||||
|
EE235FA11C5785CE00C08960 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F921C5785CE00C08960 /* ConstraintOffsetTarget.swift */; };
|
||||||
|
EE235FA21C5785CE00C08960 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F921C5785CE00C08960 /* ConstraintOffsetTarget.swift */; };
|
||||||
|
EE235FA31C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */; };
|
||||||
|
EE235FA41C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */; };
|
||||||
|
EE235FA51C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */; };
|
||||||
|
EE235FAC1C5785D400C08960 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA61C5785D400C08960 /* ConstraintMaker.swift */; };
|
||||||
|
EE235FAD1C5785D400C08960 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA61C5785D400C08960 /* ConstraintMaker.swift */; };
|
||||||
|
EE235FAE1C5785D400C08960 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA61C5785D400C08960 /* ConstraintMaker.swift */; };
|
||||||
|
EE235FAF1C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */; };
|
||||||
|
EE235FB01C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */; };
|
||||||
|
EE235FB11C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */; };
|
||||||
|
EE235FB21C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */; };
|
||||||
|
EE235FB31C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */; };
|
||||||
|
EE235FB41C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */; };
|
||||||
|
EE235FB51C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */; };
|
||||||
|
EE235FB61C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */; };
|
||||||
|
EE235FB71C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */; };
|
||||||
|
EE235FB81C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */; };
|
||||||
|
EE235FB91C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */; };
|
||||||
|
EE235FBA1C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */; };
|
||||||
|
EE235FBB1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */; };
|
||||||
|
EE235FBC1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */; };
|
||||||
|
EE235FBD1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */; };
|
||||||
|
EE235FC01C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FBE1C5785DC00C08960 /* ConstraintViewDSL.swift */; };
|
||||||
|
EE235FC11C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FBE1C5785DC00C08960 /* ConstraintViewDSL.swift */; };
|
||||||
|
EE235FC21C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FBE1C5785DC00C08960 /* ConstraintViewDSL.swift */; };
|
||||||
|
EE235FC31C5785DC00C08960 /* ConstraintViewControllerDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FBF1C5785DC00C08960 /* ConstraintViewControllerDSL.swift */; };
|
||||||
|
EE235FC41C5785DC00C08960 /* ConstraintViewControllerDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FBF1C5785DC00C08960 /* ConstraintViewControllerDSL.swift */; };
|
||||||
|
EE235FC51C5785DC00C08960 /* ConstraintViewControllerDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FBF1C5785DC00C08960 /* ConstraintViewControllerDSL.swift */; };
|
||||||
|
EE235FC81C5785E200C08960 /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */; };
|
||||||
|
EE235FC91C5785E200C08960 /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */; };
|
||||||
|
EE235FCA1C5785E200C08960 /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */; };
|
||||||
|
EE235FCB1C5785E200C08960 /* ConstraintViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FC71C5785E200C08960 /* ConstraintViewController+Extensions.swift */; };
|
||||||
|
EE235FCC1C5785E200C08960 /* ConstraintViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FC71C5785E200C08960 /* ConstraintViewController+Extensions.swift */; };
|
||||||
|
EE235FCD1C5785E200C08960 /* ConstraintViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE235FC71C5785E200C08960 /* ConstraintViewController+Extensions.swift */; };
|
||||||
EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; };
|
EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; };
|
||||||
EE94F6091AC0F10A008767FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F6081AC0F10A008767FF /* UIKit.framework */; };
|
EE94F6091AC0F10A008767FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F6081AC0F10A008767FF /* UIKit.framework */; };
|
||||||
EE94F60B1AC0F10F008767FF /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F60A1AC0F10F008767FF /* AppKit.framework */; };
|
EE94F60B1AC0F10F008767FF /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F60A1AC0F10F008767FF /* AppKit.framework */; };
|
||||||
EE94F6111AC0F146008767FF /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EECDB37A1AC0C9D4006BBC11 /* SnapKit.framework */; };
|
EE94F6111AC0F146008767FF /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EECDB37A1AC0C9D4006BBC11 /* SnapKit.framework */; };
|
||||||
EECDB36C1AC0C9A6006BBC11 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB35E1AC0C95C006BBC11 /* Constraint.swift */; };
|
|
||||||
EECDB36D1AC0C9A6006BBC11 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB35F1AC0C95C006BBC11 /* ConstraintAttributes.swift */; };
|
|
||||||
EECDB36E1AC0C9A6006BBC11 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3601AC0C95C006BBC11 /* ConstraintItem.swift */; };
|
|
||||||
EECDB36F1AC0C9A6006BBC11 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3611AC0C95C006BBC11 /* ConstraintMaker.swift */; };
|
|
||||||
EECDB3701AC0C9A6006BBC11 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3621AC0C95C006BBC11 /* ConstraintRelation.swift */; };
|
|
||||||
EECDB3711AC0C9A6006BBC11 /* EdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3631AC0C95C006BBC11 /* EdgeInsets.swift */; };
|
|
||||||
EECDB3721AC0C9A6006BBC11 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3651AC0C95C006BBC11 /* LayoutConstraint.swift */; };
|
|
||||||
EECDB3731AC0C9A6006BBC11 /* View+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3671AC0C95C006BBC11 /* View+SnapKit.swift */; };
|
|
||||||
EECDB3741AC0C9B6006BBC11 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
EECDB3741AC0C9B6006BBC11 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
EECDB3931AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
|
EECDB3931AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
|
||||||
EECDB3941AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
|
EECDB3941AC0CB52006BBC11 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB36A1AC0C95C006BBC11 /* Tests.swift */; };
|
||||||
EECDB3951AC0CBFF006BBC11 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB35E1AC0C95C006BBC11 /* Constraint.swift */; };
|
|
||||||
EECDB3961AC0CBFF006BBC11 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB35F1AC0C95C006BBC11 /* ConstraintAttributes.swift */; };
|
|
||||||
EECDB3971AC0CBFF006BBC11 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3601AC0C95C006BBC11 /* ConstraintItem.swift */; };
|
|
||||||
EECDB3981AC0CBFF006BBC11 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3611AC0C95C006BBC11 /* ConstraintMaker.swift */; };
|
|
||||||
EECDB3991AC0CBFF006BBC11 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3621AC0C95C006BBC11 /* ConstraintRelation.swift */; };
|
|
||||||
EECDB39A1AC0CBFF006BBC11 /* EdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3631AC0C95C006BBC11 /* EdgeInsets.swift */; };
|
|
||||||
EECDB39B1AC0CBFF006BBC11 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3651AC0C95C006BBC11 /* LayoutConstraint.swift */; };
|
|
||||||
EECDB39C1AC0CBFF006BBC11 /* View+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EECDB3671AC0C95C006BBC11 /* View+SnapKit.swift */; };
|
|
||||||
EECDB39D1AC0CC03006BBC11 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
EECDB39D1AC0CC03006BBC11 /* SnapKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EECDB3661AC0C95C006BBC11 /* SnapKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
EEFCF32C1AD910B900A425FA /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF32B1AD910B900A425FA /* Debugging.swift */; };
|
|
||||||
EEFCF32D1AD9250C00A425FA /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF32B1AD910B900A425FA /* Debugging.swift */; };
|
|
||||||
EEFCF32F1AD926AE00A425FA /* SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF32E1AD926AE00A425FA /* SnapKit.swift */; };
|
|
||||||
EEFCF3301AD92C2200A425FA /* SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF32E1AD926AE00A425FA /* SnapKit.swift */; };
|
|
||||||
EEFCF3321AD9432400A425FA /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF3311AD9432400A425FA /* ConstraintDescription.swift */; };
|
|
||||||
EEFCF3331AD9432400A425FA /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEFCF3311AD9432400A425FA /* ConstraintDescription.swift */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
@ -73,29 +119,44 @@
|
||||||
537DCE921C35CC8800B5B899 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
537DCE921C35CC8800B5B899 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
537DCE9A1C35CD4100B5B899 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
537DCE9A1C35CD4100B5B899 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
537DCEAF1C35D90A00B5B899 /* SnapKit tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit tvOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
537DCEAF1C35D90A00B5B899 /* SnapKit tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit tvOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
779230431BCB6FC30027CF5F /* SourceLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceLocation.swift; sourceTree = "<group>"; };
|
EE235F5E1C5785BC00C08960 /* Debugging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debugging.swift; sourceTree = "<group>"; };
|
||||||
EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ViewController+SnapKit.swift"; sourceTree = "<group>"; };
|
EE235F621C5785C600C08960 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F631C5785C600C08960 /* ConstraintDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDescription.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F641C5785C600C08960 /* ConstraintInsets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintInsets.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F651C5785C600C08960 /* ConstraintConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintConfig.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F661C5785C600C08960 /* ConstraintView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintView.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F671C5785C600C08960 /* ConstraintViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintViewController.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F681C5785C600C08960 /* ConstraintRelation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintRelation.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F691C5785C600C08960 /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintLayoutSupport.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F6A1C5785C600C08960 /* ConstraintAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintAttributes.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F6B1C5785C600C08960 /* ConstraintItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintItem.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F6C1C5785C600C08960 /* LayoutConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutConstraint.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F8E1C5785CE00C08960 /* ConstraintRelatableTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintRelatableTarget.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F8F1C5785CE00C08960 /* ConstraintConstantTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintConstantTarget.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F901C5785CE00C08960 /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintPriorityTarget.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F911C5785CE00C08960 /* ConstraintMultiplierTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMultiplierTarget.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F921C5785CE00C08960 /* ConstraintOffsetTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintOffsetTarget.swift; sourceTree = "<group>"; };
|
||||||
|
EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintInsetTarget.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FA61C5785D400C08960 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerFinalizable.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerPriortizable.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerEditable.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerRelatable.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMakerExtendable.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FBE1C5785DC00C08960 /* ConstraintViewDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintViewDSL.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FBF1C5785DC00C08960 /* ConstraintViewControllerDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintViewControllerDSL.swift; sourceTree = "<group>"; };
|
||||||
|
EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConstraintView+Extensions.swift"; sourceTree = "<group>"; };
|
||||||
|
EE235FC71C5785E200C08960 /* ConstraintViewController+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ConstraintViewController+Extensions.swift"; sourceTree = "<group>"; };
|
||||||
EE94F6081AC0F10A008767FF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
EE94F6081AC0F10A008767FF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||||
EE94F60A1AC0F10F008767FF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; };
|
EE94F60A1AC0F10F008767FF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
EEBCC9D819CC627D0083B827 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
EEBCC9D819CC627D0083B827 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EEBCC9E219CC627E0083B827 /* SnapKit iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
EEBCC9E219CC627E0083B827 /* SnapKit iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EECDB35E1AC0C95C006BBC11 /* Constraint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB35F1AC0C95C006BBC11 /* ConstraintAttributes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstraintAttributes.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB3601AC0C95C006BBC11 /* ConstraintItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstraintItem.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB3611AC0C95C006BBC11 /* ConstraintMaker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB3621AC0C95C006BBC11 /* ConstraintRelation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstraintRelation.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB3631AC0C95C006BBC11 /* EdgeInsets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EdgeInsets.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB3641AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
EECDB3641AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
EECDB3651AC0C95C006BBC11 /* LayoutConstraint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutConstraint.swift; sourceTree = "<group>"; };
|
|
||||||
EECDB3661AC0C95C006BBC11 /* SnapKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnapKit.h; sourceTree = "<group>"; };
|
EECDB3661AC0C95C006BBC11 /* SnapKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnapKit.h; sourceTree = "<group>"; };
|
||||||
EECDB3671AC0C95C006BBC11 /* View+SnapKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+SnapKit.swift"; sourceTree = "<group>"; };
|
|
||||||
EECDB3691AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
EECDB3691AC0C95C006BBC11 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
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>"; };
|
||||||
EECDB37A1AC0C9D4006BBC11 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
EECDB37A1AC0C9D4006BBC11 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EECDB3841AC0C9D4006BBC11 /* SnapKit OSX Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit OSX Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
EECDB3841AC0C9D4006BBC11 /* SnapKit OSX Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SnapKit OSX Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
EEFCF32B1AD910B900A425FA /* Debugging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Debugging.swift; sourceTree = "<group>"; };
|
|
||||||
EEFCF32E1AD926AE00A425FA /* SnapKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapKit.swift; sourceTree = "<group>"; };
|
|
||||||
EEFCF3311AD9432400A425FA /* ConstraintDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintDescription.swift; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -172,6 +233,76 @@
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
EE235F581C57858700C08960 /* Extensions */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EE235FC61C5785E200C08960 /* ConstraintView+Extensions.swift */,
|
||||||
|
EE235FC71C5785E200C08960 /* ConstraintViewController+Extensions.swift */,
|
||||||
|
);
|
||||||
|
name = Extensions;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
EE235F591C57859200C08960 /* DSLs */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EE235FBE1C5785DC00C08960 /* ConstraintViewDSL.swift */,
|
||||||
|
EE235FBF1C5785DC00C08960 /* ConstraintViewControllerDSL.swift */,
|
||||||
|
);
|
||||||
|
name = DSLs;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
EE235F5A1C57859900C08960 /* Maker */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EE235FA61C5785D400C08960 /* ConstraintMaker.swift */,
|
||||||
|
EE235FA71C5785D400C08960 /* ConstraintMakerFinalizable.swift */,
|
||||||
|
EE235FA81C5785D400C08960 /* ConstraintMakerPriortizable.swift */,
|
||||||
|
EE235FA91C5785D400C08960 /* ConstraintMakerEditable.swift */,
|
||||||
|
EE235FAA1C5785D400C08960 /* ConstraintMakerRelatable.swift */,
|
||||||
|
EE235FAB1C5785D400C08960 /* ConstraintMakerExtendable.swift */,
|
||||||
|
);
|
||||||
|
name = Maker;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
EE235F5B1C57859E00C08960 /* Targets */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EE235F8E1C5785CE00C08960 /* ConstraintRelatableTarget.swift */,
|
||||||
|
EE235F8F1C5785CE00C08960 /* ConstraintConstantTarget.swift */,
|
||||||
|
EE235F901C5785CE00C08960 /* ConstraintPriorityTarget.swift */,
|
||||||
|
EE235F911C5785CE00C08960 /* ConstraintMultiplierTarget.swift */,
|
||||||
|
EE235F921C5785CE00C08960 /* ConstraintOffsetTarget.swift */,
|
||||||
|
EE235F931C5785CE00C08960 /* ConstraintInsetTarget.swift */,
|
||||||
|
);
|
||||||
|
name = Targets;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
EE235F5C1C5785A400C08960 /* Models */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EE235F621C5785C600C08960 /* Constraint.swift */,
|
||||||
|
EE235F631C5785C600C08960 /* ConstraintDescription.swift */,
|
||||||
|
EE235F641C5785C600C08960 /* ConstraintInsets.swift */,
|
||||||
|
EE235F651C5785C600C08960 /* ConstraintConfig.swift */,
|
||||||
|
EE235F661C5785C600C08960 /* ConstraintView.swift */,
|
||||||
|
EE235F671C5785C600C08960 /* ConstraintViewController.swift */,
|
||||||
|
EE235F681C5785C600C08960 /* ConstraintRelation.swift */,
|
||||||
|
EE235F691C5785C600C08960 /* ConstraintLayoutSupport.swift */,
|
||||||
|
EE235F6A1C5785C600C08960 /* ConstraintAttributes.swift */,
|
||||||
|
EE235F6B1C5785C600C08960 /* ConstraintItem.swift */,
|
||||||
|
EE235F6C1C5785C600C08960 /* LayoutConstraint.swift */,
|
||||||
|
);
|
||||||
|
name = Models;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
EE235F5D1C5785AC00C08960 /* Debugging */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
EE235F5E1C5785BC00C08960 /* Debugging.swift */,
|
||||||
|
);
|
||||||
|
name = Debugging;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
EE94F60C1AC0F113008767FF /* Frameworks */ = {
|
EE94F60C1AC0F113008767FF /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -186,19 +317,12 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
EECDB3661AC0C95C006BBC11 /* SnapKit.h */,
|
EECDB3661AC0C95C006BBC11 /* SnapKit.h */,
|
||||||
EEFCF32E1AD926AE00A425FA /* SnapKit.swift */,
|
EE235F581C57858700C08960 /* Extensions */,
|
||||||
EECDB35E1AC0C95C006BBC11 /* Constraint.swift */,
|
EE235F591C57859200C08960 /* DSLs */,
|
||||||
EEFCF3311AD9432400A425FA /* ConstraintDescription.swift */,
|
EE235F5A1C57859900C08960 /* Maker */,
|
||||||
EECDB3611AC0C95C006BBC11 /* ConstraintMaker.swift */,
|
EE235F5B1C57859E00C08960 /* Targets */,
|
||||||
EECDB3671AC0C95C006BBC11 /* View+SnapKit.swift */,
|
EE235F5C1C5785A400C08960 /* Models */,
|
||||||
EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */,
|
EE235F5D1C5785AC00C08960 /* Debugging */,
|
||||||
EECDB3601AC0C95C006BBC11 /* ConstraintItem.swift */,
|
|
||||||
EECDB3631AC0C95C006BBC11 /* EdgeInsets.swift */,
|
|
||||||
EECDB3651AC0C95C006BBC11 /* LayoutConstraint.swift */,
|
|
||||||
EEFCF32B1AD910B900A425FA /* Debugging.swift */,
|
|
||||||
EECDB3621AC0C95C006BBC11 /* ConstraintRelation.swift */,
|
|
||||||
EECDB35F1AC0C95C006BBC11 /* ConstraintAttributes.swift */,
|
|
||||||
779230431BCB6FC30027CF5F /* SourceLocation.swift */,
|
|
||||||
EECDB36B1AC0C967006BBC11 /* Supporting Files */,
|
EECDB36B1AC0C967006BBC11 /* Supporting Files */,
|
||||||
EECDB3681AC0C95C006BBC11 /* Tests */,
|
EECDB3681AC0C95C006BBC11 /* Tests */,
|
||||||
);
|
);
|
||||||
|
@ -462,19 +586,34 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
537DCEA61C35CE2000B5B899 /* LayoutConstraint.swift in Sources */,
|
EE235F741C5785C600C08960 /* ConstraintInsets.swift in Sources */,
|
||||||
537DCE9F1C35CDB700B5B899 /* ConstraintItem.swift in Sources */,
|
EE235F831C5785C600C08960 /* ConstraintLayoutSupport.swift in Sources */,
|
||||||
537DCEA81C35CE3800B5B899 /* ConstraintRelation.swift in Sources */,
|
EE235FB01C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */,
|
||||||
537DCE9D1C35CDA300B5B899 /* SnapKit.swift in Sources */,
|
EE235F7D1C5785C600C08960 /* ConstraintViewController.swift in Sources */,
|
||||||
537DCEA51C35CE1B00B5B899 /* EdgeInsets.swift in Sources */,
|
EE235F981C5785CE00C08960 /* ConstraintConstantTarget.swift in Sources */,
|
||||||
537DCE9C1C35CD9A00B5B899 /* Constraint.swift in Sources */,
|
EE235FC91C5785E200C08960 /* ConstraintView+Extensions.swift in Sources */,
|
||||||
537DCEA41C35CE1500B5B899 /* ViewController+SnapKit.swift in Sources */,
|
EE235FB91C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */,
|
||||||
537DCE9E1C35CDAA00B5B899 /* Debugging.swift in Sources */,
|
EE235F861C5785C600C08960 /* ConstraintAttributes.swift in Sources */,
|
||||||
537DCEA11C35CE0000B5B899 /* ConstraintDescription.swift in Sources */,
|
EE235FA11C5785CE00C08960 /* ConstraintOffsetTarget.swift in Sources */,
|
||||||
537DCEAA1C35CE4800B5B899 /* SourceLocation.swift in Sources */,
|
EE235FB61C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */,
|
||||||
537DCEA91C35CE3E00B5B899 /* ConstraintAttributes.swift in Sources */,
|
EE235FAD1C5785D400C08960 /* ConstraintMaker.swift in Sources */,
|
||||||
537DCEA31C35CE0900B5B899 /* View+SnapKit.swift in Sources */,
|
EE235F951C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */,
|
||||||
537DCEA21C35CE0500B5B899 /* ConstraintMaker.swift in Sources */,
|
EE235FBC1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */,
|
||||||
|
EE235F891C5785C600C08960 /* ConstraintItem.swift in Sources */,
|
||||||
|
EE235F9B1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */,
|
||||||
|
EE235F771C5785C600C08960 /* ConstraintConfig.swift in Sources */,
|
||||||
|
EE235F6E1C5785C600C08960 /* Constraint.swift in Sources */,
|
||||||
|
EE235F7A1C5785C600C08960 /* ConstraintView.swift in Sources */,
|
||||||
|
EE235FB31C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */,
|
||||||
|
EE235FCC1C5785E200C08960 /* ConstraintViewController+Extensions.swift in Sources */,
|
||||||
|
EE235F8C1C5785C600C08960 /* LayoutConstraint.swift in Sources */,
|
||||||
|
EE235FA41C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */,
|
||||||
|
EE235F9E1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */,
|
||||||
|
EE235FC11C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */,
|
||||||
|
EE235F601C5785BC00C08960 /* Debugging.swift in Sources */,
|
||||||
|
EE235FC41C5785DC00C08960 /* ConstraintViewControllerDSL.swift in Sources */,
|
||||||
|
EE235F801C5785C600C08960 /* ConstraintRelation.swift in Sources */,
|
||||||
|
EE235F711C5785C600C08960 /* ConstraintDescription.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -490,19 +629,34 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
EECDB36C1AC0C9A6006BBC11 /* Constraint.swift in Sources */,
|
EE235F731C5785C600C08960 /* ConstraintInsets.swift in Sources */,
|
||||||
EEFCF32F1AD926AE00A425FA /* SnapKit.swift in Sources */,
|
EE235F821C5785C600C08960 /* ConstraintLayoutSupport.swift in Sources */,
|
||||||
EEFCF32C1AD910B900A425FA /* Debugging.swift in Sources */,
|
EE235FAF1C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */,
|
||||||
EECDB3701AC0C9A6006BBC11 /* ConstraintRelation.swift in Sources */,
|
EE235F7C1C5785C600C08960 /* ConstraintViewController.swift in Sources */,
|
||||||
EEFCF3321AD9432400A425FA /* ConstraintDescription.swift in Sources */,
|
EE235F971C5785CE00C08960 /* ConstraintConstantTarget.swift in Sources */,
|
||||||
EECDB3731AC0C9A6006BBC11 /* View+SnapKit.swift in Sources */,
|
EE235FC81C5785E200C08960 /* ConstraintView+Extensions.swift in Sources */,
|
||||||
EECDB3711AC0C9A6006BBC11 /* EdgeInsets.swift in Sources */,
|
EE235FB81C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */,
|
||||||
EE4910981B19A26000A54F1F /* ViewController+SnapKit.swift in Sources */,
|
EE235F851C5785C600C08960 /* ConstraintAttributes.swift in Sources */,
|
||||||
EECDB36F1AC0C9A6006BBC11 /* ConstraintMaker.swift in Sources */,
|
EE235FA01C5785CE00C08960 /* ConstraintOffsetTarget.swift in Sources */,
|
||||||
779230441BCB6FC30027CF5F /* SourceLocation.swift in Sources */,
|
EE235FB51C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */,
|
||||||
EECDB36D1AC0C9A6006BBC11 /* ConstraintAttributes.swift in Sources */,
|
EE235FAC1C5785D400C08960 /* ConstraintMaker.swift in Sources */,
|
||||||
EECDB3721AC0C9A6006BBC11 /* LayoutConstraint.swift in Sources */,
|
EE235F941C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */,
|
||||||
EECDB36E1AC0C9A6006BBC11 /* ConstraintItem.swift in Sources */,
|
EE235FBB1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */,
|
||||||
|
EE235F881C5785C600C08960 /* ConstraintItem.swift in Sources */,
|
||||||
|
EE235F9A1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */,
|
||||||
|
EE235F761C5785C600C08960 /* ConstraintConfig.swift in Sources */,
|
||||||
|
EE235F6D1C5785C600C08960 /* Constraint.swift in Sources */,
|
||||||
|
EE235F791C5785C600C08960 /* ConstraintView.swift in Sources */,
|
||||||
|
EE235FB21C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */,
|
||||||
|
EE235FCB1C5785E200C08960 /* ConstraintViewController+Extensions.swift in Sources */,
|
||||||
|
EE235F8B1C5785C600C08960 /* LayoutConstraint.swift in Sources */,
|
||||||
|
EE235FA31C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */,
|
||||||
|
EE235F9D1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */,
|
||||||
|
EE235FC01C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */,
|
||||||
|
EE235F5F1C5785BC00C08960 /* Debugging.swift in Sources */,
|
||||||
|
EE235FC31C5785DC00C08960 /* ConstraintViewControllerDSL.swift in Sources */,
|
||||||
|
EE235F7F1C5785C600C08960 /* ConstraintRelation.swift in Sources */,
|
||||||
|
EE235F701C5785C600C08960 /* ConstraintDescription.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -518,18 +672,34 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
EECDB3951AC0CBFF006BBC11 /* Constraint.swift in Sources */,
|
EE235F751C5785C600C08960 /* ConstraintInsets.swift in Sources */,
|
||||||
EEFCF3301AD92C2200A425FA /* SnapKit.swift in Sources */,
|
EE235F841C5785C600C08960 /* ConstraintLayoutSupport.swift in Sources */,
|
||||||
EEFCF32D1AD9250C00A425FA /* Debugging.swift in Sources */,
|
EE235FB11C5785D400C08960 /* ConstraintMakerFinalizable.swift in Sources */,
|
||||||
EECDB3991AC0CBFF006BBC11 /* ConstraintRelation.swift in Sources */,
|
EE235F7E1C5785C600C08960 /* ConstraintViewController.swift in Sources */,
|
||||||
EEFCF3331AD9432400A425FA /* ConstraintDescription.swift in Sources */,
|
EE235F991C5785CE00C08960 /* ConstraintConstantTarget.swift in Sources */,
|
||||||
EECDB39C1AC0CBFF006BBC11 /* View+SnapKit.swift in Sources */,
|
EE235FCA1C5785E200C08960 /* ConstraintView+Extensions.swift in Sources */,
|
||||||
EECDB39A1AC0CBFF006BBC11 /* EdgeInsets.swift in Sources */,
|
EE235FBA1C5785D400C08960 /* ConstraintMakerRelatable.swift in Sources */,
|
||||||
EECDB3981AC0CBFF006BBC11 /* ConstraintMaker.swift in Sources */,
|
EE235F871C5785C600C08960 /* ConstraintAttributes.swift in Sources */,
|
||||||
EECDB3961AC0CBFF006BBC11 /* ConstraintAttributes.swift in Sources */,
|
EE235FA21C5785CE00C08960 /* ConstraintOffsetTarget.swift in Sources */,
|
||||||
779230451BCB6FC30027CF5F /* SourceLocation.swift in Sources */,
|
EE235FB71C5785D400C08960 /* ConstraintMakerEditable.swift in Sources */,
|
||||||
EECDB39B1AC0CBFF006BBC11 /* LayoutConstraint.swift in Sources */,
|
EE235FAE1C5785D400C08960 /* ConstraintMaker.swift in Sources */,
|
||||||
EECDB3971AC0CBFF006BBC11 /* ConstraintItem.swift in Sources */,
|
EE235F961C5785CE00C08960 /* ConstraintRelatableTarget.swift in Sources */,
|
||||||
|
EE235FBD1C5785D400C08960 /* ConstraintMakerExtendable.swift in Sources */,
|
||||||
|
EE235F8A1C5785C600C08960 /* ConstraintItem.swift in Sources */,
|
||||||
|
EE235F9C1C5785CE00C08960 /* ConstraintPriorityTarget.swift in Sources */,
|
||||||
|
EE235F781C5785C600C08960 /* ConstraintConfig.swift in Sources */,
|
||||||
|
EE235F6F1C5785C600C08960 /* Constraint.swift in Sources */,
|
||||||
|
EE235F7B1C5785C600C08960 /* ConstraintView.swift in Sources */,
|
||||||
|
EE235FB41C5785D400C08960 /* ConstraintMakerPriortizable.swift in Sources */,
|
||||||
|
EE235FCD1C5785E200C08960 /* ConstraintViewController+Extensions.swift in Sources */,
|
||||||
|
EE235F8D1C5785C600C08960 /* LayoutConstraint.swift in Sources */,
|
||||||
|
EE235FA51C5785CE00C08960 /* ConstraintInsetTarget.swift in Sources */,
|
||||||
|
EE235F9F1C5785CE00C08960 /* ConstraintMultiplierTarget.swift in Sources */,
|
||||||
|
EE235FC21C5785DC00C08960 /* ConstraintViewDSL.swift in Sources */,
|
||||||
|
EE235F611C5785BC00C08960 /* Debugging.swift in Sources */,
|
||||||
|
EE235FC51C5785DC00C08960 /* ConstraintViewControllerDSL.swift in Sources */,
|
||||||
|
EE235F811C5785C600C08960 /* ConstraintRelation.swift in Sources */,
|
||||||
|
EE235F721C5785C600C08960 /* ConstraintDescription.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -555,6 +725,7 @@
|
||||||
537DCE971C35CC8800B5B899 /* Debug */ = {
|
537DCE971C35CC8800B5B899 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
|
@ -569,6 +740,7 @@
|
||||||
PRODUCT_NAME = SnapKit;
|
PRODUCT_NAME = SnapKit;
|
||||||
SDKROOT = appletvos;
|
SDKROOT = appletvos;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
TARGETED_DEVICE_FAMILY = 3;
|
TARGETED_DEVICE_FAMILY = 3;
|
||||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
@ -579,6 +751,7 @@
|
||||||
537DCE981C35CC8800B5B899 /* Release */ = {
|
537DCE981C35CC8800B5B899 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
@ -716,6 +889,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
@ -728,6 +902,7 @@
|
||||||
PRODUCT_NAME = SnapKit;
|
PRODUCT_NAME = SnapKit;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
};
|
};
|
||||||
|
@ -737,6 +912,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
@ -779,6 +955,7 @@
|
||||||
EECDB38E1AC0C9D4006BBC11 /* Debug */ = {
|
EECDB38E1AC0C9D4006BBC11 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
|
@ -799,6 +976,7 @@
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SUPPORTED_PLATFORMS = macosx;
|
SUPPORTED_PLATFORMS = macosx;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = "";
|
VERSION_INFO_PREFIX = "";
|
||||||
};
|
};
|
||||||
|
@ -807,6 +985,7 @@
|
||||||
EECDB38F1AC0C9D4006BBC11 /* Release */ = {
|
EECDB38F1AC0C9D4006BBC11 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
@ -878,6 +1057,7 @@
|
||||||
537DCEB81C35D90A00B5B899 /* Release */,
|
537DCEB81C35D90A00B5B899 /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
DDC9FD901981B4DD009612C7 /* Build configuration list for PBXProject "SnapKit" */ = {
|
DDC9FD901981B4DD009612C7 /* Build configuration list for PBXProject "SnapKit" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
|
|
|
@ -22,241 +22,111 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose API's for a Constraint
|
|
||||||
*/
|
|
||||||
public class Constraint {
|
public class Constraint {
|
||||||
|
|
||||||
public func install() -> [LayoutConstraint] { fatalError("Must be implemented by Concrete subclass.") }
|
internal let sourceLocation: (String, UInt)
|
||||||
public func uninstall() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func activate() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func deactivate() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
|
|
||||||
public func updateOffset(amount: Float) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
private let from: ConstraintItem
|
||||||
public func updateOffset(amount: Double) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
private let to: ConstraintItem
|
||||||
public func updateOffset(amount: CGFloat) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updateOffset(amount: Int) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updateOffset(amount: UInt) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updateOffset(amount: CGPoint) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updateOffset(amount: CGSize) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updateOffset(amount: EdgeInsets) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
|
|
||||||
public func updateInsets(amount: EdgeInsets) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
|
|
||||||
public func updatePriority(priority: Float) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriority(priority: Double) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriority(priority: CGFloat) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriority(priority: UInt) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriority(priority: Int) -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriorityRequired() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriorityHigh() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
|
||||||
|
|
||||||
internal var makerLocation: SourceLocation = SourceLocation(file: "Unknown", line: 0)
|
|
||||||
|
|
||||||
internal(set) public var location: SourceLocation?
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used internally to implement a ConcreteConstraint
|
|
||||||
*/
|
|
||||||
internal class ConcreteConstraint: Constraint {
|
|
||||||
|
|
||||||
internal override func updateOffset(amount: Float) -> Void {
|
|
||||||
self.constant = amount
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: Double) -> Void {
|
|
||||||
self.updateOffset(Float(amount))
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: CGFloat) -> Void {
|
|
||||||
self.updateOffset(Float(amount))
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: Int) -> Void {
|
|
||||||
self.updateOffset(Float(amount))
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: UInt) -> Void {
|
|
||||||
self.updateOffset(Float(amount))
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: CGPoint) -> Void {
|
|
||||||
self.constant = amount
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: CGSize) -> Void {
|
|
||||||
self.constant = amount
|
|
||||||
}
|
|
||||||
internal override func updateOffset(amount: EdgeInsets) -> Void {
|
|
||||||
self.constant = amount
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override func updateInsets(amount: EdgeInsets) -> Void {
|
|
||||||
self.constant = EdgeInsets(top: amount.top, left: amount.left, bottom: -amount.bottom, right: -amount.right)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override func updatePriority(priority: Float) -> Void {
|
|
||||||
self.priority = priority
|
|
||||||
}
|
|
||||||
internal override func updatePriority(priority: Double) -> Void {
|
|
||||||
self.updatePriority(Float(priority))
|
|
||||||
}
|
|
||||||
internal override func updatePriority(priority: CGFloat) -> Void {
|
|
||||||
self.updatePriority(Float(priority))
|
|
||||||
}
|
|
||||||
internal override func updatePriority(priority: UInt) -> Void {
|
|
||||||
self.updatePriority(Float(priority))
|
|
||||||
}
|
|
||||||
internal override func updatePriority(priority: Int) -> Void {
|
|
||||||
self.updatePriority(Float(priority))
|
|
||||||
}
|
|
||||||
internal override func updatePriorityRequired() -> Void {
|
|
||||||
self.updatePriority(Float(1000.0))
|
|
||||||
}
|
|
||||||
internal override func updatePriorityHigh() -> Void {
|
|
||||||
self.updatePriority(Float(750.0))
|
|
||||||
}
|
|
||||||
internal override func updatePriorityMedium() -> Void {
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
self.updatePriority(Float(500.0))
|
|
||||||
#else
|
|
||||||
self.updatePriority(Float(501.0))
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
internal override func updatePriorityLow() -> Void {
|
|
||||||
self.updatePriority(Float(250.0))
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override func install() -> [LayoutConstraint] {
|
|
||||||
return self.installOnView(updateExisting: false, location: self.makerLocation)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override func uninstall() -> Void {
|
|
||||||
self.uninstallFromView()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override func activate() -> Void {
|
|
||||||
guard self.installInfo != nil else {
|
|
||||||
self.install()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY
|
|
||||||
guard #available(iOS 8.0, OSX 10.10, *) else {
|
|
||||||
self.install()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
let layoutConstraints = self.installInfo!.layoutConstraints.allObjects as! [LayoutConstraint]
|
|
||||||
if layoutConstraints.count > 0 {
|
|
||||||
NSLayoutConstraint.activateConstraints(layoutConstraints)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override func deactivate() -> Void {
|
|
||||||
guard self.installInfo != nil else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY
|
|
||||||
guard #available(iOS 8.0, OSX 10.10, *) else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
let layoutConstraints = self.installInfo!.layoutConstraints.allObjects as! [LayoutConstraint]
|
|
||||||
if layoutConstraints.count > 0 {
|
|
||||||
NSLayoutConstraint.deactivateConstraints(layoutConstraints)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private let fromItem: ConstraintItem
|
|
||||||
private let toItem: ConstraintItem
|
|
||||||
private let relation: ConstraintRelation
|
private let relation: ConstraintRelation
|
||||||
private let multiplier: Float
|
private let multiplier: ConstraintMultiplierTarget
|
||||||
private var constant: Any {
|
private var constant: ConstraintConstantTarget
|
||||||
didSet {
|
private var priority: ConstraintPriorityTarget
|
||||||
if let installInfo = self.installInfo {
|
private var installInfo: ConstraintInstallInfo? = nil
|
||||||
for layoutConstraint in installInfo.layoutConstraints.allObjects as! [LayoutConstraint] {
|
|
||||||
let attribute = (layoutConstraint.secondAttribute == .NotAnAttribute) ? layoutConstraint.firstAttribute : layoutConstraint.secondAttribute
|
|
||||||
layoutConstraint.constant = attribute.snp_constantForValue(self.constant)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var priority: Float {
|
|
||||||
didSet {
|
|
||||||
if let installInfo = self.installInfo {
|
|
||||||
for layoutConstraint in installInfo.layoutConstraints.allObjects as! [LayoutConstraint] {
|
|
||||||
layoutConstraint.priority = self.priority
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var installInfo: ConcreteConstraintInstallInfo? = nil
|
// MARK: Initialization
|
||||||
|
|
||||||
internal init(fromItem: ConstraintItem, toItem: ConstraintItem, relation: ConstraintRelation, constant: Any, multiplier: Float, priority: Float, location: SourceLocation?) {
|
internal init(from: ConstraintItem,
|
||||||
self.fromItem = fromItem
|
to: ConstraintItem,
|
||||||
self.toItem = toItem
|
relation: ConstraintRelation,
|
||||||
|
sourceLocation: (String, UInt),
|
||||||
|
multiplier: ConstraintMultiplierTarget,
|
||||||
|
constant: ConstraintConstantTarget,
|
||||||
|
priority: ConstraintPriorityTarget) {
|
||||||
|
self.from = from
|
||||||
|
self.to = to
|
||||||
self.relation = relation
|
self.relation = relation
|
||||||
self.constant = constant
|
self.sourceLocation = sourceLocation
|
||||||
self.multiplier = multiplier
|
self.multiplier = multiplier
|
||||||
|
self.constant = constant
|
||||||
self.priority = priority
|
self.priority = priority
|
||||||
super.init()
|
|
||||||
self.location = location
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func installOnView(updateExisting updateExisting: Bool = false, location: SourceLocation? = nil) -> [LayoutConstraint] {
|
// MARK: Public
|
||||||
var installOnView: View? = nil
|
|
||||||
if self.toItem.view != nil {
|
public func install() -> [NSLayoutConstraint] {
|
||||||
installOnView = closestCommonSuperviewFromView(self.fromItem.view, toView: self.toItem.view)
|
return self.installIfNeeded(updateExisting: false)
|
||||||
if installOnView == nil {
|
}
|
||||||
NSException(name: "Cannot Install Constraint", reason: "No common superview between views (@\(self.makerLocation.file)#\(self.makerLocation.line))", userInfo: nil).raise()
|
|
||||||
return []
|
public func uninstall() {
|
||||||
|
self.uninstallIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.10, *)
|
||||||
|
public func activate() {
|
||||||
|
self.activateIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, OSX 10.10, *)
|
||||||
|
public func deactivate() {
|
||||||
|
self.deactivateIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Internal
|
||||||
|
|
||||||
|
internal func installIfNeeded(updateExisting updateExisting: Bool = false) -> [NSLayoutConstraint] {
|
||||||
|
let installOnView: ConstraintView?
|
||||||
|
|
||||||
|
if let view = self.to.view {
|
||||||
|
guard let closestSuperview = closestCommonSuperviewFromView(self.from.view, toView: view) else {
|
||||||
|
fatalError("Cannot Install Constraint. No common superview. (\(self.sourceLocation.0), \(self.sourceLocation.1))")
|
||||||
}
|
}
|
||||||
|
installOnView = closestSuperview
|
||||||
|
} else if self.from.attributes.isSubsetOf(ConstraintAttributes.Width + ConstraintAttributes.Height) {
|
||||||
|
installOnView = self.from.view
|
||||||
} else {
|
} else {
|
||||||
|
guard let superview = self.from.view?.superview else {
|
||||||
if self.fromItem.attributes.isSubsetOf(ConstraintAttributes.Width.union(.Height)) {
|
fatalError("Cannot Install Constraint. No superview. (\(self.sourceLocation.0), \(self.sourceLocation.1))")
|
||||||
installOnView = self.fromItem.view
|
|
||||||
} else {
|
|
||||||
installOnView = self.fromItem.view?.superview
|
|
||||||
if installOnView == nil {
|
|
||||||
NSException(name: "Cannot Install Constraint", reason: "Missing superview (@\(self.makerLocation.file)#\(self.self.makerLocation.line))", userInfo: nil).raise()
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
installOnView = superview
|
||||||
}
|
}
|
||||||
|
|
||||||
if let installedOnView = self.installInfo?.view {
|
guard self.installInfo?.view == nil ||
|
||||||
if installedOnView != installOnView {
|
self.installInfo?.view == installOnView else {
|
||||||
NSException(name: "Cannot Install Constraint", reason: "Already installed on different view. (@\(self.makerLocation.file)#\(self.makerLocation.line))", userInfo: nil).raise()
|
fatalError("Cannot Install Constraint. Already installed on different view. (\(self.sourceLocation.0), \(self.sourceLocation.1))")
|
||||||
return []
|
|
||||||
}
|
|
||||||
return self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint] ?? []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup array to store new layout constraints
|
||||||
var newLayoutConstraints = [LayoutConstraint]()
|
var newLayoutConstraints = [LayoutConstraint]()
|
||||||
let layoutFromAttributes = self.fromItem.attributes.layoutAttributes
|
|
||||||
let layoutToAttributes = self.toItem.attributes.layoutAttributes
|
// get attributes
|
||||||
|
let layoutFromAttributes = self.from.attributes.layoutAttributes
|
||||||
|
let layoutToAttributes = self.to.attributes.layoutAttributes
|
||||||
|
|
||||||
// get layout from
|
// get layout from
|
||||||
let layoutFrom: View? = self.fromItem.view
|
let layoutFrom: ConstraintView = self.from.view!
|
||||||
|
|
||||||
// get layout relation
|
// get relation
|
||||||
let layoutRelation: NSLayoutRelation = self.relation.layoutRelation
|
let layoutRelation = self.relation.layoutRelation
|
||||||
|
|
||||||
for layoutFromAttribute in layoutFromAttributes {
|
for layoutFromAttribute in layoutFromAttributes {
|
||||||
// get layout to attribute
|
// get layout to attribute
|
||||||
let layoutToAttribute = (layoutToAttributes.count > 0) ? layoutToAttributes[0] : layoutFromAttribute
|
let layoutToAttribute = (layoutToAttributes.count > 0) ? layoutToAttributes[0] : layoutFromAttribute
|
||||||
|
|
||||||
// get layout constant
|
// get layout constant
|
||||||
let layoutConstant: CGFloat = layoutToAttribute.snp_constantForValue(self.constant)
|
let layoutConstant: CGFloat = self.constant.layoutConstantForLayoutAttribute(layoutToAttribute)
|
||||||
|
|
||||||
// get layout to
|
// get layout to
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
var layoutTo: AnyObject? = self.toItem.view ?? self.toItem.layoutSupport
|
var layoutTo: AnyObject? = self.to.view ?? self.to.layoutSupport
|
||||||
#else
|
#else
|
||||||
var layoutTo: AnyObject? = self.toItem.view
|
var layoutTo: AnyObject? = self.to.view
|
||||||
#endif
|
#endif
|
||||||
if layoutTo == nil && layoutToAttribute != .Width && layoutToAttribute != .Height {
|
if layoutTo == nil && layoutToAttribute != .Width && layoutToAttribute != .Height {
|
||||||
layoutTo = installOnView
|
layoutTo = installOnView
|
||||||
|
@ -264,27 +134,30 @@ internal class ConcreteConstraint: Constraint {
|
||||||
|
|
||||||
// create layout constraint
|
// create layout constraint
|
||||||
let layoutConstraint = LayoutConstraint(
|
let layoutConstraint = LayoutConstraint(
|
||||||
item: layoutFrom!,
|
item: layoutFrom,
|
||||||
attribute: layoutFromAttribute,
|
attribute: layoutFromAttribute,
|
||||||
relatedBy: layoutRelation,
|
relatedBy: layoutRelation,
|
||||||
toItem: layoutTo,
|
toItem: layoutTo,
|
||||||
attribute: layoutToAttribute,
|
attribute: layoutToAttribute,
|
||||||
multiplier: CGFloat(self.multiplier),
|
multiplier: self.multiplier.constraintMultiplierTargetValue,
|
||||||
constant: layoutConstant)
|
constant: layoutConstant
|
||||||
|
)
|
||||||
|
|
||||||
// set priority
|
// set priority
|
||||||
layoutConstraint.priority = self.priority
|
layoutConstraint.priority = self.priority.constraintPriorityTargetValue
|
||||||
|
|
||||||
// set constraint
|
// set constraint
|
||||||
layoutConstraint.snp_constraint = self
|
layoutConstraint.constraint = self
|
||||||
|
|
||||||
|
// append
|
||||||
newLayoutConstraints.append(layoutConstraint)
|
newLayoutConstraints.append(layoutConstraint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// special logic for updating
|
// updating logic
|
||||||
if updateExisting {
|
if updateExisting {
|
||||||
|
|
||||||
// get existing constraints for this view
|
// get existing constraints for this view
|
||||||
let existingLayoutConstraints = layoutFrom!.snp_installedLayoutConstraints.reverse()
|
let existingLayoutConstraints = layoutFrom.snp.installedLayoutConstraints.reverse()
|
||||||
|
|
||||||
// array that will contain only new layout constraints to keep
|
// array that will contain only new layout constraints to keep
|
||||||
var newLayoutConstraintsToKeep = [LayoutConstraint]()
|
var newLayoutConstraintsToKeep = [LayoutConstraint]()
|
||||||
|
@ -306,7 +179,7 @@ internal class ConcreteConstraint: Constraint {
|
||||||
if updateLayoutConstraint != nil {
|
if updateLayoutConstraint != nil {
|
||||||
updateLayoutConstraint!.constant = layoutConstraint.constant
|
updateLayoutConstraint!.constant = layoutConstraint.constant
|
||||||
}
|
}
|
||||||
// otherwise add this layout constraint to new keep list
|
// otherwise add this layout constraint to new keep list
|
||||||
else {
|
else {
|
||||||
newLayoutConstraintsToKeep.append(layoutConstraint)
|
newLayoutConstraintsToKeep.append(layoutConstraint)
|
||||||
}
|
}
|
||||||
|
@ -317,18 +190,18 @@ internal class ConcreteConstraint: Constraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add constraints
|
// add constraints
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX)
|
#if SNAPKIT_DEPLOYMENT_LEGACY && (os(iOS) || os(tvOS))
|
||||||
if #available(iOS 8.0, *) {
|
if #available(iOS 8.0, *) {
|
||||||
NSLayoutConstraint.activateConstraints(newLayoutConstraints)
|
NSLayoutConstraint.activateConstraints(newLayoutConstraints)
|
||||||
} else {
|
} else {
|
||||||
installOnView!.addConstraints(newLayoutConstraints)
|
installOnView?.addConstraints(newLayoutConstraints)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
NSLayoutConstraint.activateConstraints(newLayoutConstraints)
|
NSLayoutConstraint.activateConstraints(newLayoutConstraints)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set install info
|
// set install info
|
||||||
self.installInfo = ConcreteConstraintInstallInfo(view: installOnView, layoutConstraints: NSHashTable.weakObjectsHashTable())
|
self.installInfo = ConstraintInstallInfo(view: installOnView, layoutConstraints: NSHashTable.weakObjectsHashTable())
|
||||||
|
|
||||||
// store which layout constraints are installed for this constraint
|
// store which layout constraints are installed for this constraint
|
||||||
for layoutConstraint in newLayoutConstraints {
|
for layoutConstraint in newLayoutConstraints {
|
||||||
|
@ -336,141 +209,86 @@ internal class ConcreteConstraint: Constraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the layout constraints against the layout from view
|
// store the layout constraints against the layout from view
|
||||||
layoutFrom!.snp_installedLayoutConstraints += newLayoutConstraints
|
layoutFrom.snp.appendInstalledLayoutConstraints(newLayoutConstraints)
|
||||||
|
|
||||||
// return the new constraints
|
|
||||||
return newLayoutConstraints
|
return newLayoutConstraints
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func uninstallFromView() {
|
internal func uninstallIfNeeded() {
|
||||||
if let installInfo = self.installInfo,
|
defer {
|
||||||
let installedLayoutConstraints = installInfo.layoutConstraints.allObjects as? [LayoutConstraint] {
|
self.installInfo = nil
|
||||||
|
|
||||||
if installedLayoutConstraints.count > 0 {
|
|
||||||
// remove the constraints from the UIView's storage
|
|
||||||
#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 {
|
|
||||||
fromView.snp_installedLayoutConstraints = fromView.snp_installedLayoutConstraints.filter {
|
|
||||||
return !installedLayoutConstraints.contains($0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
self.installInfo = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct ConcreteConstraintInstallInfo {
|
|
||||||
|
|
||||||
weak var view: View? = nil
|
|
||||||
let layoutConstraints: NSHashTable
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private extension NSLayoutAttribute {
|
|
||||||
|
|
||||||
private func snp_constantForValue(value: Any?) -> CGFloat {
|
|
||||||
// Float
|
|
||||||
if let float = value as? Float {
|
|
||||||
return CGFloat(float)
|
|
||||||
}
|
|
||||||
// Double
|
|
||||||
else if let double = value as? Double {
|
|
||||||
return CGFloat(double)
|
|
||||||
}
|
|
||||||
// UInt
|
|
||||||
else if let int = value as? Int {
|
|
||||||
return CGFloat(int)
|
|
||||||
}
|
|
||||||
// Int
|
|
||||||
else if let uint = value as? UInt {
|
|
||||||
return CGFloat(uint)
|
|
||||||
}
|
|
||||||
// CGFloat
|
|
||||||
else if let float = value as? CGFloat {
|
|
||||||
return float
|
|
||||||
}
|
|
||||||
// CGSize
|
|
||||||
else if let size = value as? CGSize {
|
|
||||||
if self == .Width {
|
|
||||||
return size.width
|
|
||||||
} else if self == .Height {
|
|
||||||
return size.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// CGPoint
|
|
||||||
else if let point = value as? CGPoint {
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
switch self {
|
|
||||||
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return point.x
|
|
||||||
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return point.y
|
|
||||||
case .Right, .RightMargin: return point.x
|
|
||||||
case .Bottom, .BottomMargin: return point.y
|
|
||||||
case .Leading, .LeadingMargin: return point.x
|
|
||||||
case .Trailing, .TrailingMargin: return point.x
|
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
switch self {
|
|
||||||
case .Left, .CenterX: return point.x
|
|
||||||
case .Top, .CenterY, .Baseline: return point.y
|
|
||||||
case .Right: return point.x
|
|
||||||
case .Bottom: return point.y
|
|
||||||
case .Leading: return point.x
|
|
||||||
case .Trailing: return point.x
|
|
||||||
case .Width, .Height, .NotAnAttribute: return CGFloat(0)
|
|
||||||
case .FirstBaseline: return point.y
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
// EdgeInsets
|
|
||||||
else if let insets = value as? EdgeInsets {
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
switch self {
|
|
||||||
case .Left, .CenterX, .LeftMargin, .CenterXWithinMargins: return insets.left
|
|
||||||
case .Top, .CenterY, .TopMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline: return insets.top
|
|
||||||
case .Right, .RightMargin: return insets.right
|
|
||||||
case .Bottom, .BottomMargin: return insets.bottom
|
|
||||||
case .Leading, .LeadingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
|
||||||
case .Trailing, .TrailingMargin: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : -insets.left
|
|
||||||
case .Width: return -insets.left + insets.right
|
|
||||||
case .Height: return -insets.top + insets.bottom
|
|
||||||
case .NotAnAttribute: return CGFloat(0)
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
switch self {
|
|
||||||
case .Left, .CenterX: return insets.left
|
|
||||||
case .Top, .CenterY, .Baseline: return insets.top
|
|
||||||
case .Right: return insets.right
|
|
||||||
case .Bottom: return insets.bottom
|
|
||||||
case .Leading: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.left : -insets.right
|
|
||||||
case .Trailing: return (Config.interfaceLayoutDirection == .LeftToRight) ? insets.right : -insets.left
|
|
||||||
case .Width: return -insets.left + insets.right
|
|
||||||
case .Height: return -insets.top + insets.bottom
|
|
||||||
case .NotAnAttribute: return CGFloat(0)
|
|
||||||
case .FirstBaseline: return insets.bottom
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CGFloat(0);
|
guard let installedLayoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint]
|
||||||
|
where installedLayoutConstraints.count > 0 else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
self.from.view?.snp.removeInstalledLayoutConstraints(installedLayoutConstraints)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal func activateIfNeeded() {
|
||||||
|
guard self.installInfo != nil else {
|
||||||
|
self.installIfNeeded()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#if SNAPKIT_DEPLOYMENT_LEGACY
|
||||||
|
guard #available(iOS 8.0, OSX 10.10, *) else {
|
||||||
|
self.installIfNeeded()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
guard let layoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint]
|
||||||
|
where layoutConstraints.count > 0 else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLayoutConstraint.activateConstraints(layoutConstraints)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func deactivateIfNeeded() {
|
||||||
|
#if SNAPKIT_DEPLOYMENT_LEGACY
|
||||||
|
guard #available(iOS 8.0, OSX 10.10, *) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
guard let layoutConstraints = self.installInfo?.layoutConstraints.allObjects as? [LayoutConstraint]
|
||||||
|
where layoutConstraints.count > 0 else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLayoutConstraint.deactivateConstraints(layoutConstraints)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func closestCommonSuperviewFromView(fromView: View?, toView: View?) -> View? {
|
private final class ConstraintInstallInfo {
|
||||||
var views = Set<View>()
|
|
||||||
|
private weak var view: ConstraintView? = nil
|
||||||
|
private let layoutConstraints: NSHashTable
|
||||||
|
|
||||||
|
private init(view: ConstraintView?, layoutConstraints: NSHashTable) {
|
||||||
|
self.view = view
|
||||||
|
self.layoutConstraints = layoutConstraints
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private func closestCommonSuperviewFromView(fromView: ConstraintView?, toView: ConstraintView?) -> ConstraintView? {
|
||||||
|
var views = Set<ConstraintView>()
|
||||||
var fromView = fromView
|
var fromView = fromView
|
||||||
var toView = toView
|
var toView = toView
|
||||||
repeat {
|
repeat {
|
||||||
|
@ -493,10 +311,10 @@ private func closestCommonSuperviewFromView(fromView: View?, toView: View?) -> V
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
private func ==(left: ConcreteConstraint, right: ConcreteConstraint) -> Bool {
|
private func ==(lhs: Constraint, rhs: Constraint) -> Bool {
|
||||||
return (left.fromItem == right.fromItem &&
|
return (lhs.from == rhs.from &&
|
||||||
left.toItem == right.toItem &&
|
lhs.to == rhs.to &&
|
||||||
left.relation == right.relation &&
|
lhs.relation == rhs.relation &&
|
||||||
left.multiplier == right.multiplier &&
|
lhs.multiplier == rhs.multiplier &&
|
||||||
left.priority == right.priority)
|
lhs.priority == rhs.priority)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,14 +22,12 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to define `NSLayoutAttributes` in a more concise and composite manner
|
|
||||||
*/
|
|
||||||
internal struct ConstraintAttributes: OptionSetType, BooleanType {
|
internal struct ConstraintAttributes: OptionSetType, BooleanType {
|
||||||
|
|
||||||
internal init(rawValue: UInt) {
|
internal init(rawValue: UInt) {
|
||||||
|
@ -134,49 +132,56 @@ internal struct ConstraintAttributes: OptionSetType, BooleanType {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
#if SNAPKIT_DEPLOYMENT_LEGACY
|
#if SNAPKIT_DEPLOYMENT_LEGACY
|
||||||
guard #available(iOS 8.0, *) else {
|
guard #available(iOS 8.0, *) else {
|
||||||
return attrs
|
return attrs
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (self.contains(ConstraintAttributes.FirstBaseline)) {
|
if (self.contains(ConstraintAttributes.FirstBaseline)) {
|
||||||
attrs.append(.FirstBaseline)
|
attrs.append(.FirstBaseline)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.LeftMargin)) {
|
if (self.contains(ConstraintAttributes.LeftMargin)) {
|
||||||
attrs.append(.LeftMargin)
|
attrs.append(.LeftMargin)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.RightMargin)) {
|
if (self.contains(ConstraintAttributes.RightMargin)) {
|
||||||
attrs.append(.RightMargin)
|
attrs.append(.RightMargin)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.TopMargin)) {
|
if (self.contains(ConstraintAttributes.TopMargin)) {
|
||||||
attrs.append(.TopMargin)
|
attrs.append(.TopMargin)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.BottomMargin)) {
|
if (self.contains(ConstraintAttributes.BottomMargin)) {
|
||||||
attrs.append(.BottomMargin)
|
attrs.append(.BottomMargin)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.LeadingMargin)) {
|
if (self.contains(ConstraintAttributes.LeadingMargin)) {
|
||||||
attrs.append(.LeadingMargin)
|
attrs.append(.LeadingMargin)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.TrailingMargin)) {
|
if (self.contains(ConstraintAttributes.TrailingMargin)) {
|
||||||
attrs.append(.TrailingMargin)
|
attrs.append(.TrailingMargin)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.CenterXWithinMargins)) {
|
if (self.contains(ConstraintAttributes.CenterXWithinMargins)) {
|
||||||
attrs.append(.CenterXWithinMargins)
|
attrs.append(.CenterXWithinMargins)
|
||||||
}
|
}
|
||||||
if (self.contains(ConstraintAttributes.CenterYWithinMargins)) {
|
if (self.contains(ConstraintAttributes.CenterYWithinMargins)) {
|
||||||
attrs.append(.CenterYWithinMargins)
|
attrs.append(.CenterYWithinMargins)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return attrs
|
return attrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal func + (left: ConstraintAttributes, right: ConstraintAttributes) -> ConstraintAttributes {
|
||||||
|
return left.union(right)
|
||||||
|
}
|
||||||
|
|
||||||
internal func +=(inout left: ConstraintAttributes, right: ConstraintAttributes) {
|
internal func +=(inout left: ConstraintAttributes, right: ConstraintAttributes) {
|
||||||
left.unionInPlace(right)
|
left.unionInPlace(right)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func -=(inout left: ConstraintAttributes, right: ConstraintAttributes) {
|
internal func -=(inout left: ConstraintAttributes, right: ConstraintAttributes) {
|
||||||
left.subtractInPlace(right)
|
left.subtractInPlace(right)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool {
|
internal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool {
|
||||||
return left.rawValue == right.rawValue
|
return left.rawValue == right.rawValue
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,21 +22,16 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
public typealias InterfaceLayoutDirection = UIUserInterfaceLayoutDirection
|
public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection
|
||||||
public typealias LayoutSupport = UILayoutSupport
|
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
public typealias InterfaceLayoutDirection = NSUserInterfaceLayoutDirection
|
public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection
|
||||||
public class LayoutSupport {}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to configure different parts of SnapKit
|
public struct ConstraintConfig {
|
||||||
*/
|
|
||||||
public struct Config {
|
|
||||||
|
|
||||||
/// The interface layout direction
|
public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .LeftToRight
|
||||||
public static var interfaceLayoutDirection = InterfaceLayoutDirection.LeftToRight
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,148 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGPoint: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGSize: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsets: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintConstantTarget {
|
||||||
|
|
||||||
|
internal func layoutConstantForLayoutAttribute(layoutAttribute: NSLayoutAttribute) -> CGFloat {
|
||||||
|
if let value = self as? Float {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? Double {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? Int {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? UInt {
|
||||||
|
return CGFloat(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? CGFloat {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? CGSize {
|
||||||
|
if layoutAttribute == .Width {
|
||||||
|
return value.width
|
||||||
|
} else if layoutAttribute == .Height {
|
||||||
|
return value.height
|
||||||
|
} else {
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if let value = self as? CGPoint {
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .Left, .Right, .Leading, .Trailing, .CenterX, .LeftMargin, .RightMargin, .LeadingMargin, .TrailingMargin, .CenterXWithinMargins:
|
||||||
|
return value.x
|
||||||
|
case .Top, .Bottom, .CenterY, .TopMargin, .BottomMargin, .CenterYWithinMargins, .Baseline, .FirstBaseline:
|
||||||
|
return value.y
|
||||||
|
case .Width, .Height, .NotAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .Left, .Right, .Leading, .Trailing, .CenterX:
|
||||||
|
return value.x
|
||||||
|
case .Top, .Bottom, .CenterY, .Baseline, .FirstBaseline:
|
||||||
|
return value.y
|
||||||
|
case .Width, .Height, .NotAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if let value = self as? ConstraintInsets {
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .Left, .LeftMargin, .CenterX, .CenterXWithinMargins:
|
||||||
|
return value.left
|
||||||
|
case .Top, .TopMargin, .CenterY, .CenterYWithinMargins, .Baseline, .FirstBaseline:
|
||||||
|
return value.top
|
||||||
|
case .Right, .RightMargin:
|
||||||
|
return value.right
|
||||||
|
case .Bottom, .BottomMargin:
|
||||||
|
return value.bottom
|
||||||
|
case .Leading, .LeadingMargin:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .LeftToRight) ? value.left : -value.right
|
||||||
|
case .Trailing, .TrailingMargin:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .LeftToRight) ? value.right : -value.left
|
||||||
|
case .Width:
|
||||||
|
return -value.left + value.right
|
||||||
|
case .Height:
|
||||||
|
return -value.top + value.bottom
|
||||||
|
case .NotAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
switch layoutAttribute {
|
||||||
|
case .Left, .CenterX:
|
||||||
|
return value.left
|
||||||
|
case .Top, .CenterY, .Baseline, .FirstBaseline:
|
||||||
|
return value.top
|
||||||
|
case .Right:
|
||||||
|
return value.right
|
||||||
|
case .Bottom:
|
||||||
|
return value.bottom
|
||||||
|
case .Leading:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .LeftToRight) ? value.left : -value.right
|
||||||
|
case .Trailing:
|
||||||
|
return (ConstraintConfig.interfaceLayoutDirection == .LeftToRight) ? value.right : -value.left
|
||||||
|
case .Width:
|
||||||
|
return -value.left + value.right
|
||||||
|
case .Height:
|
||||||
|
return -value.top + value.bottom
|
||||||
|
case .NotAnAttribute:
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,488 +22,46 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public protocol RelationTarget {
|
|
||||||
var constraintItem: ConstraintItem { get }
|
|
||||||
}
|
|
||||||
|
|
||||||
public protocol FloatConvertible: RelationTarget {
|
public class ConstraintDescription {
|
||||||
var floatValue: Float { get }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension FloatConvertible {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return ConstraintItem(object: nil, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Float: FloatConvertible, RelationTarget {
|
|
||||||
public var floatValue: Float {
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Int: FloatConvertible, RelationTarget {
|
|
||||||
public var floatValue: Float {
|
|
||||||
return Float(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension UInt: FloatConvertible, RelationTarget {
|
|
||||||
public var floatValue: Float {
|
|
||||||
return Float(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension Double: FloatConvertible, RelationTarget {
|
|
||||||
public var floatValue: Float {
|
|
||||||
return Float(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension CGFloat: FloatConvertible, RelationTarget {
|
|
||||||
public var floatValue: Float {
|
|
||||||
return Float(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@available(iOS 9.0, OSX 10.11, *)
|
|
||||||
extension NSLayoutAnchor: RelationTarget {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return ConstraintItem(object: self, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension CGPoint: RelationTarget {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return ConstraintItem(object: nil, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension CGSize: RelationTarget {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return ConstraintItem(object: nil, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension EdgeInsets: RelationTarget {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return ConstraintItem(object: nil, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension View: RelationTarget {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return ConstraintItem(object: self, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ConstraintItem: RelationTarget {
|
|
||||||
public var constraintItem: ConstraintItem {
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose the final API of a `ConstraintDescription` which allows getting a constraint from it
|
|
||||||
*/
|
|
||||||
public class ConstraintDescriptionFinalizable {
|
|
||||||
|
|
||||||
private let backing: ConstraintDescription
|
internal let view: ConstraintView
|
||||||
|
internal var attributes: ConstraintAttributes
|
||||||
internal init(_ backing: ConstraintDescription) {
|
internal var relation: ConstraintRelation? = nil
|
||||||
self.backing = backing
|
internal var sourceLocation: (String, UInt)? = nil
|
||||||
}
|
internal var related: ConstraintItem? = nil
|
||||||
|
internal var multiplier: ConstraintMultiplierTarget = 1.0
|
||||||
public var constraint: Constraint {
|
internal var constant: ConstraintConstantTarget = 0.0
|
||||||
return backing.constraint
|
internal var priority: ConstraintPriorityTarget = 1000.0
|
||||||
}
|
internal var constraint: Constraint? {
|
||||||
}
|
guard let relation = self.relation,
|
||||||
|
let related = self.related,
|
||||||
/**
|
let sourceLocation = self.sourceLocation else {
|
||||||
Used to expose priority APIs
|
return nil
|
||||||
*/
|
|
||||||
public class ConstraintDescriptionPriortizable: ConstraintDescriptionFinalizable {
|
|
||||||
|
|
||||||
public func priority(priority: FloatConvertible) -> ConstraintDescriptionFinalizable {
|
|
||||||
return ConstraintDescriptionFinalizable(self.backing.priority(priority))
|
|
||||||
}
|
|
||||||
|
|
||||||
public func priorityRequired() -> ConstraintDescriptionFinalizable {
|
|
||||||
return ConstraintDescriptionFinalizable(self.backing.priorityRequired())
|
|
||||||
}
|
|
||||||
public func priorityHigh() -> ConstraintDescriptionFinalizable {
|
|
||||||
return ConstraintDescriptionFinalizable(self.backing.priorityHigh())
|
|
||||||
}
|
|
||||||
public func priorityMedium() -> ConstraintDescriptionFinalizable {
|
|
||||||
return ConstraintDescriptionFinalizable(self.backing.priorityMedium())
|
|
||||||
}
|
|
||||||
public func priorityLow() -> ConstraintDescriptionFinalizable {
|
|
||||||
return ConstraintDescriptionFinalizable(self.backing.priorityLow())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose multiplier & constant APIs
|
|
||||||
*/
|
|
||||||
public class ConstraintDescriptionEditable: ConstraintDescriptionPriortizable {
|
|
||||||
|
|
||||||
public func multipliedBy(amount: FloatConvertible) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.multipliedBy(amount))
|
|
||||||
}
|
|
||||||
|
|
||||||
public func dividedBy(amount: FloatConvertible) -> ConstraintDescriptionEditable {
|
|
||||||
return self.multipliedBy(1 / amount.floatValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func offset(amount: FloatConvertible) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.offset(amount))
|
|
||||||
}
|
|
||||||
public func offset(amount: CGPoint) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.offset(amount))
|
|
||||||
}
|
|
||||||
public func offset(amount: CGSize) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.offset(amount))
|
|
||||||
}
|
|
||||||
public func offset(amount: EdgeInsets) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.offset(amount))
|
|
||||||
}
|
|
||||||
|
|
||||||
public func inset(amount: FloatConvertible) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.inset(amount))
|
|
||||||
}
|
|
||||||
public func inset(amount: EdgeInsets) -> ConstraintDescriptionEditable {
|
|
||||||
return ConstraintDescriptionEditable(self.backing.inset(amount))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose relation APIs
|
|
||||||
*/
|
|
||||||
public class ConstraintDescriptionRelatable {
|
|
||||||
|
|
||||||
private let backing: ConstraintDescription
|
|
||||||
|
|
||||||
init(_ backing: ConstraintDescription) {
|
|
||||||
self.backing = backing
|
|
||||||
}
|
|
||||||
|
|
||||||
public func equalTo(other: RelationTarget, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
|
|
||||||
let location = SourceLocation(file: file, line: line)
|
|
||||||
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .Equal, location: location))
|
|
||||||
}
|
|
||||||
public func equalTo(other: LayoutSupport, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
|
|
||||||
let location = SourceLocation(file: file, line: line)
|
|
||||||
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .Equal, location: location))
|
|
||||||
}
|
|
||||||
|
|
||||||
public func lessThanOrEqualTo(other: RelationTarget, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
|
|
||||||
let location = SourceLocation(file: file, line: line)
|
|
||||||
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .LessThanOrEqualTo, location: location))
|
|
||||||
}
|
|
||||||
public func lessThanOrEqualTo(other: LayoutSupport, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
|
|
||||||
let location = SourceLocation(file: file, line: line)
|
|
||||||
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .LessThanOrEqualTo, location: location))
|
|
||||||
}
|
|
||||||
|
|
||||||
public func greaterThanOrEqualTo(other: RelationTarget, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
|
|
||||||
let location = SourceLocation(file: file, line: line)
|
|
||||||
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .GreaterThanOrEqualTo, location: location))
|
|
||||||
}
|
|
||||||
public func greaterThanOrEqualTo(other: LayoutSupport, file: String = __FILE__, line: UInt = __LINE__) -> ConstraintDescriptionEditable {
|
|
||||||
let location = SourceLocation(file: file, line: line)
|
|
||||||
return ConstraintDescriptionEditable(self.backing.constrainTo(other, relation: .GreaterThanOrEqualTo, location: location))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose chaining APIs
|
|
||||||
*/
|
|
||||||
public class ConstraintDescriptionExtendable: ConstraintDescriptionRelatable {
|
|
||||||
|
|
||||||
public var left: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.left)
|
|
||||||
}
|
|
||||||
public var top: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.top)
|
|
||||||
}
|
|
||||||
public var bottom: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.bottom)
|
|
||||||
}
|
|
||||||
public var right: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.right)
|
|
||||||
}
|
|
||||||
public var leading: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.leading)
|
|
||||||
}
|
|
||||||
public var trailing: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.trailing)
|
|
||||||
}
|
|
||||||
public var width: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.width)
|
|
||||||
}
|
|
||||||
public var height: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.height)
|
|
||||||
}
|
|
||||||
public var centerX: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.centerX)
|
|
||||||
}
|
|
||||||
public var centerY: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.centerY)
|
|
||||||
}
|
|
||||||
public var baseline: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.baseline)
|
|
||||||
}
|
|
||||||
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var firstBaseline: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.firstBaseline)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var leftMargin: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.leftMargin)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var rightMargin: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.rightMargin)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var topMargin: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.topMargin)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var bottomMargin: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.bottomMargin)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var leadingMargin: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.leadingMargin)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var trailingMargin: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.trailingMargin)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var centerXWithinMargins: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.centerXWithinMargins)
|
|
||||||
}
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var centerYWithinMargins: ConstraintDescriptionExtendable {
|
|
||||||
return ConstraintDescriptionExtendable(self.backing.centerYWithinMargins)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to internally manage building constraint
|
|
||||||
*/
|
|
||||||
internal class ConstraintDescription {
|
|
||||||
|
|
||||||
private var location: SourceLocation? = nil
|
|
||||||
|
|
||||||
private var left: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Left) }
|
|
||||||
private var top: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Top) }
|
|
||||||
private var right: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Right) }
|
|
||||||
private var bottom: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Bottom) }
|
|
||||||
private var leading: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Leading) }
|
|
||||||
private var trailing: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Trailing) }
|
|
||||||
private var width: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Width) }
|
|
||||||
private var height: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Height) }
|
|
||||||
private var centerX: ConstraintDescription { return self.addConstraint(ConstraintAttributes.CenterX) }
|
|
||||||
private var centerY: ConstraintDescription { return self.addConstraint(ConstraintAttributes.CenterY) }
|
|
||||||
private var baseline: ConstraintDescription { return self.addConstraint(ConstraintAttributes.Baseline) }
|
|
||||||
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var firstBaseline: ConstraintDescription { return self.addConstraint(ConstraintAttributes.FirstBaseline) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var leftMargin: ConstraintDescription { return self.addConstraint(ConstraintAttributes.LeftMargin) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var rightMargin: ConstraintDescription { return self.addConstraint(ConstraintAttributes.RightMargin) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var topMargin: ConstraintDescription { return self.addConstraint(ConstraintAttributes.TopMargin) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var bottomMargin: ConstraintDescription { return self.addConstraint(ConstraintAttributes.BottomMargin) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var leadingMargin: ConstraintDescription { return self.addConstraint(ConstraintAttributes.LeadingMargin) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var trailingMargin: ConstraintDescription { return self.addConstraint(ConstraintAttributes.TrailingMargin) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var centerXWithinMargins: ConstraintDescription { return self.addConstraint(ConstraintAttributes.CenterXWithinMargins) }
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
private var centerYWithinMargins: ConstraintDescription { return self.addConstraint(ConstraintAttributes.CenterYWithinMargins) }
|
|
||||||
|
|
||||||
// MARK: initializer
|
|
||||||
|
|
||||||
init(fromItem: ConstraintItem) {
|
|
||||||
self.fromItem = fromItem
|
|
||||||
self.toItem = ConstraintItem(object: nil, attributes: ConstraintAttributes.None)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: multiplier
|
|
||||||
|
|
||||||
private func multipliedBy(amount: FloatConvertible) -> ConstraintDescription {
|
|
||||||
self.multiplier = amount.floatValue
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
||||||
private func dividedBy(amount: FloatConvertible) -> ConstraintDescription {
|
|
||||||
self.multiplier = 1.0 / amount.floatValue;
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: offset
|
|
||||||
|
|
||||||
private func offset(amount: FloatConvertible) -> ConstraintDescription {
|
|
||||||
self.constant = amount.floatValue
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
private func offset(amount: CGPoint) -> ConstraintDescription {
|
|
||||||
self.constant = amount
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
private func offset(amount: CGSize) -> ConstraintDescription {
|
|
||||||
self.constant = amount
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
private func offset(amount: EdgeInsets) -> ConstraintDescription {
|
|
||||||
self.constant = amount
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: inset
|
|
||||||
|
|
||||||
private func inset(amount: FloatConvertible) -> ConstraintDescription {
|
|
||||||
let value = CGFloat(amount.floatValue)
|
|
||||||
self.constant = EdgeInsets(top: value, left: value, bottom: -value, right: -value)
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
private func inset(amount: EdgeInsets) -> ConstraintDescription {
|
|
||||||
self.constant = EdgeInsets(top: amount.top, left: amount.left, bottom: -amount.bottom, right: -amount.right)
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: priority
|
|
||||||
|
|
||||||
private func priority(priority: FloatConvertible) -> ConstraintDescription {
|
|
||||||
self.priority = priority.floatValue
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
private func priorityRequired() -> ConstraintDescription {
|
|
||||||
return self.priority(1000.0)
|
|
||||||
}
|
|
||||||
private func priorityHigh() -> ConstraintDescription {
|
|
||||||
return self.priority(750.0)
|
|
||||||
}
|
|
||||||
private func priorityMedium() -> ConstraintDescription {
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
return self.priority(500.0)
|
|
||||||
#else
|
|
||||||
return self.priority(501.0)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
private func priorityLow() -> ConstraintDescription {
|
|
||||||
return self.priority(250.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Constraint
|
|
||||||
|
|
||||||
internal var constraint: Constraint {
|
|
||||||
if self.concreteConstraint == nil {
|
|
||||||
if self.relation == nil {
|
|
||||||
fatalError("Attempting to create a constraint from a ConstraintDescription before it has been fully chained.")
|
|
||||||
}
|
|
||||||
self.concreteConstraint = ConcreteConstraint(
|
|
||||||
fromItem: self.fromItem,
|
|
||||||
toItem: self.toItem,
|
|
||||||
relation: self.relation!,
|
|
||||||
constant: self.constant,
|
|
||||||
multiplier: self.multiplier,
|
|
||||||
priority: self.priority,
|
|
||||||
location: self.location
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return self.concreteConstraint!
|
let from = ConstraintItem(target: self.view, attributes: self.attributes)
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Private
|
|
||||||
|
|
||||||
private let fromItem: ConstraintItem
|
|
||||||
private var toItem: ConstraintItem {
|
|
||||||
willSet {
|
|
||||||
if self.concreteConstraint != nil {
|
|
||||||
fatalError("Attempting to modify a ConstraintDescription after its constraint has been created.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var relation: ConstraintRelation? {
|
|
||||||
willSet {
|
|
||||||
if self.concreteConstraint != nil {
|
|
||||||
fatalError("Attempting to modify a ConstraintDescription after its constraint has been created.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var constant: Any = Float(0.0) {
|
|
||||||
willSet {
|
|
||||||
if self.concreteConstraint != nil {
|
|
||||||
fatalError("Attempting to modify a ConstraintDescription after its constraint has been created.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var multiplier: Float = 1.0 {
|
|
||||||
willSet {
|
|
||||||
if self.concreteConstraint != nil {
|
|
||||||
fatalError("Attempting to modify a ConstraintDescription after its constraint has been created.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var priority: Float = 1000.0 {
|
|
||||||
willSet {
|
|
||||||
if self.concreteConstraint != nil {
|
|
||||||
fatalError("Attempting to modify a ConstraintDescription after its constraint has been created.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var concreteConstraint: ConcreteConstraint? = nil
|
|
||||||
|
|
||||||
private func addConstraint(attributes: ConstraintAttributes) -> ConstraintDescription {
|
|
||||||
if self.relation == nil {
|
|
||||||
self.fromItem.attributes += attributes
|
|
||||||
}
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
||||||
private func constrainTo(other: RelationTarget, relation: ConstraintRelation, location: SourceLocation) -> ConstraintDescription {
|
|
||||||
|
|
||||||
self.location = location
|
return Constraint(
|
||||||
|
from: from,
|
||||||
if let constant = other as? FloatConvertible {
|
to: related,
|
||||||
self.constant = constant.floatValue
|
relation: relation,
|
||||||
}
|
sourceLocation: sourceLocation,
|
||||||
|
multiplier: self.multiplier,
|
||||||
let item = other.constraintItem
|
constant: self.constant,
|
||||||
|
priority: self.priority
|
||||||
if item.attributes != ConstraintAttributes.None {
|
)
|
||||||
let toLayoutAttributes = item.attributes.layoutAttributes
|
|
||||||
if toLayoutAttributes.count > 1 {
|
|
||||||
let fromLayoutAttributes = self.fromItem.attributes.layoutAttributes
|
|
||||||
if toLayoutAttributes != fromLayoutAttributes {
|
|
||||||
NSException(name: "Invalid Constraint", reason: "Cannot constrain to multiple non identical attributes", userInfo: nil).raise()
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
item.attributes = ConstraintAttributes.None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.toItem = item
|
|
||||||
self.relation = relation
|
|
||||||
return self
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 7.0, *)
|
// MARK: Initialization
|
||||||
private func constrainTo(other: LayoutSupport, relation: ConstraintRelation, location: SourceLocation) -> ConstraintDescription {
|
|
||||||
return constrainTo(ConstraintItem(object: other, attributes: ConstraintAttributes.None), relation: relation, location: location)
|
internal init(view: ConstraintView, attributes: ConstraintAttributes) {
|
||||||
|
self.view = view
|
||||||
|
self.attributes = attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,17 +22,29 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
public typealias EdgeInsets = UIEdgeInsets
|
|
||||||
public func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets {
|
|
||||||
return EdgeInsets(top: top, left: left, bottom: bottom, right: right)
|
|
||||||
}
|
|
||||||
public let EdgeInsetsZero = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
public typealias EdgeInsets = NSEdgeInsets
|
|
||||||
public func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets {
|
|
||||||
return EdgeInsets(top: top, left: left, bottom: bottom, right: right)
|
|
||||||
}
|
|
||||||
public let EdgeInsetsZero = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintInsetTarget: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintInsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsets: ConstraintInsetTarget {
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
public typealias ConstraintInsets = UIEdgeInsets
|
||||||
|
#else
|
||||||
|
public typealias ConstraintInsets = NSEdgeInsets
|
||||||
|
#endif
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,47 +22,44 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to assist in building a constraint
|
public class ConstraintItem: Equatable {
|
||||||
*/
|
|
||||||
public class ConstraintItem {
|
|
||||||
|
|
||||||
internal init(object: AnyObject?, attributes: ConstraintAttributes) {
|
internal weak var target: AnyObject?
|
||||||
self.object = object
|
internal let attributes: ConstraintAttributes
|
||||||
|
|
||||||
|
internal init(target: AnyObject?, attributes: ConstraintAttributes) {
|
||||||
|
self.target = target
|
||||||
self.attributes = attributes
|
self.attributes = attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
internal weak var object: AnyObject?
|
internal var view: ConstraintView? {
|
||||||
internal var attributes: ConstraintAttributes
|
return self.target as? ConstraintView
|
||||||
|
|
||||||
internal var view: View? {
|
|
||||||
return self.object as? View
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 7.0, *)
|
internal var layoutSupport: ConstraintLayoutSupport? {
|
||||||
internal var layoutSupport: LayoutSupport? {
|
return self.target as? ConstraintLayoutSupport
|
||||||
return self.object as? LayoutSupport
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {
|
||||||
internal func ==(left: ConstraintItem, right: ConstraintItem) -> Bool {
|
// pointer equality
|
||||||
if left.object == nil {
|
guard lhs !== rhs else {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
if right.object == nil {
|
|
||||||
return false
|
// must both have valid targets and identical attributes
|
||||||
}
|
guard let target1 = lhs.target,
|
||||||
if left.object !== right.object {
|
let target2 = rhs.target
|
||||||
return false
|
where target1 === target2 && lhs.attributes == rhs.attributes else {
|
||||||
}
|
return false
|
||||||
if left.attributes != right.attributes {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,10 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
public struct SourceLocation {
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
public let file: String
|
internal typealias ConstraintLayoutSupport = UILayoutSupport
|
||||||
public let line: UInt
|
#else
|
||||||
|
import AppKit
|
||||||
init(file: String, line: UInt) {
|
internal class ConstraintLayoutSupport { }
|
||||||
self.file = file
|
#endif
|
||||||
self.line = line
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,169 +22,160 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to make constraints
|
|
||||||
*/
|
|
||||||
public class ConstraintMaker {
|
public class ConstraintMaker {
|
||||||
|
|
||||||
/// left edge
|
public var left: ConstraintMakerExtendable {
|
||||||
public var left: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Left) }
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Left)
|
||||||
|
}
|
||||||
|
public var top: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Top)
|
||||||
|
}
|
||||||
|
public var bottom: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Bottom)
|
||||||
|
}
|
||||||
|
public var right: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Right)
|
||||||
|
}
|
||||||
|
public var leading: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Leading)
|
||||||
|
}
|
||||||
|
public var trailing: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Trailing)
|
||||||
|
}
|
||||||
|
public var width: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Width)
|
||||||
|
}
|
||||||
|
public var height: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Height)
|
||||||
|
}
|
||||||
|
|
||||||
/// top edge
|
public var centerX: ConstraintMakerExtendable {
|
||||||
public var top: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Top) }
|
return self.makeExtendableWithAttributes(ConstraintAttributes.CenterX)
|
||||||
|
}
|
||||||
|
public var centerY: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.CenterY)
|
||||||
|
}
|
||||||
|
public var baseline: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Baseline)
|
||||||
|
}
|
||||||
|
|
||||||
/// right edge
|
|
||||||
public var right: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Right) }
|
|
||||||
|
|
||||||
/// bottom edge
|
|
||||||
public var bottom: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Bottom) }
|
|
||||||
|
|
||||||
/// leading edge
|
|
||||||
public var leading: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Leading) }
|
|
||||||
|
|
||||||
/// trailing edge
|
|
||||||
public var trailing: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Trailing) }
|
|
||||||
|
|
||||||
/// width dimension
|
|
||||||
public var width: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Width) }
|
|
||||||
|
|
||||||
/// height dimension
|
|
||||||
public var height: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Height) }
|
|
||||||
|
|
||||||
/// centerX dimension
|
|
||||||
public var centerX: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.CenterX) }
|
|
||||||
|
|
||||||
/// centerY dimension
|
|
||||||
public var centerY: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.CenterY) }
|
|
||||||
|
|
||||||
/// baseline position
|
|
||||||
public var baseline: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Baseline) }
|
|
||||||
|
|
||||||
/// firse baseline position
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var firstBaseline: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.FirstBaseline) }
|
public var firstBaseline: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.FirstBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
/// left margin
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var leftMargin: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.LeftMargin) }
|
public var leftMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.LeftMargin)
|
||||||
|
}
|
||||||
|
|
||||||
/// right margin
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var rightMargin: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.RightMargin) }
|
public var rightMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.RightMargin)
|
||||||
|
}
|
||||||
|
|
||||||
/// top margin
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var topMargin: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.TopMargin) }
|
public var bottomMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.BottomMargin)
|
||||||
|
}
|
||||||
|
|
||||||
/// bottom margin
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var bottomMargin: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.BottomMargin) }
|
public var leadingMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.LeadingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
/// leading margin
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var leadingMargin: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.LeadingMargin) }
|
public var trailingMargin: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.TrailingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
/// trailing margin
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var trailingMargin: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.TrailingMargin) }
|
public var centerXWithinMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.CenterXWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
/// centerX within margins
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var centerXWithinMargins: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.CenterXWithinMargins) }
|
public var centerYWithinMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.CenterYWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var edges: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Edges)
|
||||||
|
}
|
||||||
|
public var size: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Size)
|
||||||
|
}
|
||||||
|
|
||||||
/// centerY within margins
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var centerYWithinMargins: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.CenterYWithinMargins) }
|
public var margins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.Margins)
|
||||||
|
}
|
||||||
|
|
||||||
/// top + left + bottom + right edges
|
|
||||||
public var edges: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Edges) }
|
|
||||||
|
|
||||||
/// width + height dimensions
|
|
||||||
public var size: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Size) }
|
|
||||||
|
|
||||||
// centerX + centerY positions
|
|
||||||
public var center: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Center) }
|
|
||||||
|
|
||||||
// top + left + bottom + right margins
|
|
||||||
@available(iOS 8.0, *)
|
@available(iOS 8.0, *)
|
||||||
public var margins: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.Margins) }
|
public var centerWithinMargins: ConstraintMakerExtendable {
|
||||||
|
return self.makeExtendableWithAttributes(ConstraintAttributes.CenterWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
// centerX + centerY within margins
|
private let view: ConstraintView
|
||||||
@available(iOS 8.0, *)
|
private var descriptions = [ConstraintDescription]()
|
||||||
public var centerWithinMargins: ConstraintDescriptionExtendable { return self.makeConstraintDescription(ConstraintAttributes.CenterWithinMargins) }
|
|
||||||
|
|
||||||
internal init(view: View, location: SourceLocation) {
|
internal init(view: ConstraintView) {
|
||||||
self.view = view
|
self.view = view
|
||||||
self.location = location
|
self.view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
}
|
}
|
||||||
|
|
||||||
internal let location: SourceLocation
|
internal func makeExtendableWithAttributes(attributes: ConstraintAttributes) -> ConstraintMakerExtendable {
|
||||||
internal let view: View
|
let description = ConstraintDescription(view: self.view, attributes: attributes)
|
||||||
internal var constraintDescriptions = [ConstraintDescription]()
|
self.descriptions.append(description)
|
||||||
|
return ConstraintMakerExtendable(description)
|
||||||
internal func makeConstraintDescription(attributes: ConstraintAttributes) -> ConstraintDescriptionExtendable {
|
|
||||||
let item = ConstraintItem(object: self.view, attributes: attributes)
|
|
||||||
let constraintDescription = ConstraintDescription(fromItem: item)
|
|
||||||
self.constraintDescriptions.append(constraintDescription)
|
|
||||||
return ConstraintDescriptionExtendable(constraintDescription)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class func prepareConstraints(view view: View, location: SourceLocation, @noescape closure: (make: ConstraintMaker) -> Void) -> [Constraint] {
|
internal static func prepareConstraints(view view: ConstraintView, @noescape closure: (make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
let maker = ConstraintMaker(view: view, location: location)
|
let maker = ConstraintMaker(view: view)
|
||||||
closure(make: maker)
|
closure(make: maker)
|
||||||
|
let constraints = maker.descriptions
|
||||||
let constraints = maker.constraintDescriptions.map { $0.constraint }
|
.map { $0.constraint }
|
||||||
for constraint in constraints {
|
.filter { $0 != nil }
|
||||||
constraint.makerLocation = maker.location
|
.map { $0! }
|
||||||
}
|
|
||||||
return constraints
|
return constraints
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class func makeConstraints(view view: View, location: SourceLocation, @noescape closure: (make: ConstraintMaker) -> Void) {
|
internal static func makeConstraints(view view: ConstraintView, @noescape closure: (make: ConstraintMaker) -> Void) {
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
let maker = ConstraintMaker(view: view)
|
||||||
let maker = ConstraintMaker(view: view, location: location)
|
|
||||||
closure(make: maker)
|
closure(make: maker)
|
||||||
|
let constraints = maker.descriptions
|
||||||
let constraints = maker.constraintDescriptions.map { $0.constraint as! ConcreteConstraint }
|
.map { $0.constraint }
|
||||||
|
.filter { $0 != nil }
|
||||||
|
.map { $0! }
|
||||||
for constraint in constraints {
|
for constraint in constraints {
|
||||||
constraint.makerLocation = maker.location
|
constraint.installIfNeeded()
|
||||||
constraint.installOnView(updateExisting: false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class func remakeConstraints(view view: View, location: SourceLocation, @noescape closure: (make: ConstraintMaker) -> Void) {
|
internal static func remakeConstraints(view view: ConstraintView, @noescape closure: (make: ConstraintMaker) -> Void) {
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
let maker = ConstraintMaker(view: view, location: location)
|
|
||||||
closure(make: maker)
|
|
||||||
|
|
||||||
self.removeConstraints(view: view)
|
self.removeConstraints(view: view)
|
||||||
let constraints = maker.constraintDescriptions.map { $0.constraint as! ConcreteConstraint }
|
self.makeConstraints(view: view, closure: closure)
|
||||||
for constraint in constraints {
|
|
||||||
constraint.makerLocation = maker.location
|
|
||||||
constraint.installOnView(updateExisting: false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class func updateConstraints(view view: View, location: SourceLocation, @noescape closure: (make: ConstraintMaker) -> Void) {
|
internal static func updateConstraints(view view: ConstraintView, @noescape closure: (make: ConstraintMaker) -> Void) {
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
let maker = ConstraintMaker(view: view)
|
||||||
let maker = ConstraintMaker(view: view, location: location)
|
|
||||||
closure(make: maker)
|
closure(make: maker)
|
||||||
|
let constraints = maker.descriptions
|
||||||
let constraints = maker.constraintDescriptions.map { $0.constraint as! ConcreteConstraint}
|
.map { $0.constraint }
|
||||||
|
.filter { $0 != nil }
|
||||||
|
.map { $0! }
|
||||||
for constraint in constraints {
|
for constraint in constraints {
|
||||||
constraint.makerLocation = maker.location
|
constraint.installIfNeeded(updateExisting: true)
|
||||||
constraint.installOnView(updateExisting: true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class func removeConstraints(view view: View) {
|
internal static func removeConstraints(view view: ConstraintView) {
|
||||||
for existingLayoutConstraint in view.snp_installedLayoutConstraints {
|
|
||||||
existingLayoutConstraint.snp_constraint?.uninstall()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerEditable: ConstraintMakerPriortizable {
|
||||||
|
|
||||||
|
public func multipliedBy(amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
|
||||||
|
self.description.multiplier = amount
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public func dividedBy(amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
|
||||||
|
return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func offset(amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {
|
||||||
|
self.description.constant = amount
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public func inset(amount: ConstraintInsetTarget) -> ConstraintMakerEditable {
|
||||||
|
let insets: ConstraintInsets
|
||||||
|
|
||||||
|
if let amount = amount as? ConstraintInsets {
|
||||||
|
insets = amount
|
||||||
|
} else if let amount = amount as? Float {
|
||||||
|
insets = ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else if let amount = amount as? Double {
|
||||||
|
insets = ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else if let amount = amount as? CGFloat {
|
||||||
|
insets = ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)
|
||||||
|
} else if let amount = amount as? Int {
|
||||||
|
insets = ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else if let amount = amount as? UInt {
|
||||||
|
insets = ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
|
||||||
|
} else {
|
||||||
|
insets = ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.description.constant = ConstraintInsets(top: insets.top, left: insets.left, bottom: -insets.bottom, right: -insets.right)
|
||||||
|
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerExtendable: ConstraintMakerRelatable {
|
||||||
|
|
||||||
|
public var left: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Left
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var top: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Top
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var bottom: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Bottom
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var right: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Right
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var leading: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Leading
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var trailing: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Trailing
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var width: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Width
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Height
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerX: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.CenterX
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerY: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.CenterY
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var baseline: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Baseline
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var firstBaseline: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.FirstBaseline
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leftMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.LeftMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var rightMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.RightMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var bottomMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.BottomMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leadingMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.LeadingMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var trailingMargin: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.TrailingMargin
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerXWithinMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.CenterXWithinMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerYWithinMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.CenterYWithinMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
public var edges: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Edges
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
public var size: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Size
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var margins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.Margins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerWithinMargins: ConstraintMakerExtendable {
|
||||||
|
self.description.attributes += ConstraintAttributes.CenterWithinMargins
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerFinalizable {
|
||||||
|
|
||||||
|
internal let description: ConstraintDescription
|
||||||
|
|
||||||
|
internal init(_ description: ConstraintDescription) {
|
||||||
|
self.description = description
|
||||||
|
}
|
||||||
|
|
||||||
|
public var constraint: Constraint {
|
||||||
|
return self.description.constraint!
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,24 +22,37 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose public API on view controllers
|
public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
|
||||||
*/
|
|
||||||
public extension UIViewController {
|
|
||||||
|
|
||||||
/// top layout guide top
|
public func priority(amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
|
||||||
public var snp_topLayoutGuideTop: ConstraintItem { return ConstraintItem(object: self.topLayoutGuide, attributes: ConstraintAttributes.Top) }
|
self.description.priority = amount
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
/// top layout guide bottom
|
public func priorityRequired() -> ConstraintMakerFinalizable {
|
||||||
public var snp_topLayoutGuideBottom: ConstraintItem { return ConstraintItem(object: self.topLayoutGuide, attributes: ConstraintAttributes.Bottom) }
|
return self.priority(1000)
|
||||||
|
}
|
||||||
|
|
||||||
/// bottom layout guide top
|
public func priorityHigh() -> ConstraintMakerFinalizable {
|
||||||
public var snp_bottomLayoutGuideTop: ConstraintItem { return ConstraintItem(object: self.bottomLayoutGuide, attributes: ConstraintAttributes.Top) }
|
return self.priority(750)
|
||||||
|
}
|
||||||
|
|
||||||
/// bottom layout guide bottom
|
public func priorityMedium() -> ConstraintMakerFinalizable {
|
||||||
public var snp_bottomLayoutGuideBottom: ConstraintItem { return ConstraintItem(object: self.bottomLayoutGuide, attributes: ConstraintAttributes.Bottom) }
|
#if os(iOS) || os(tvOS)
|
||||||
|
return self.priority(500)
|
||||||
|
#else
|
||||||
|
return self.priority(501)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public func priorityLow() -> ConstraintMakerFinalizable {
|
||||||
|
return self.priority(250)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class ConstraintMakerRelatable {
|
||||||
|
|
||||||
|
internal let description: ConstraintDescription
|
||||||
|
|
||||||
|
internal init(_ description: ConstraintDescription) {
|
||||||
|
self.description = description
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func relatedTo(other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable {
|
||||||
|
let related: ConstraintItem
|
||||||
|
let constant: ConstraintConstantTarget
|
||||||
|
|
||||||
|
if let other = other as? ConstraintItem {
|
||||||
|
guard other.attributes == ConstraintAttributes.None ||
|
||||||
|
other.attributes.layoutAttributes.count <= 1 ||
|
||||||
|
other.attributes.layoutAttributes == self.description.attributes.layoutAttributes else {
|
||||||
|
fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))");
|
||||||
|
}
|
||||||
|
|
||||||
|
related = other
|
||||||
|
constant = 0.0
|
||||||
|
} else if let other = other as? ConstraintView {
|
||||||
|
related = ConstraintItem(target: other, attributes: ConstraintAttributes.None)
|
||||||
|
constant = 0.0
|
||||||
|
} else if let other = other as? ConstraintConstantTarget {
|
||||||
|
related = ConstraintItem(target: nil, attributes: ConstraintAttributes.None)
|
||||||
|
constant = other
|
||||||
|
} else {
|
||||||
|
fatalError("Invalid constraint. (\(file), \(line))")
|
||||||
|
}
|
||||||
|
|
||||||
|
let editable = ConstraintMakerEditable(self.description)
|
||||||
|
editable.description.sourceLocation = (file, line)
|
||||||
|
editable.description.relation = relation
|
||||||
|
editable.description.related = related
|
||||||
|
editable.description.constant = constant
|
||||||
|
return editable
|
||||||
|
}
|
||||||
|
|
||||||
|
public func equalTo(other: ConstraintRelatableTarget, _ file: String = __FILE__, _ line: UInt = __LINE__) -> ConstraintMakerEditable {
|
||||||
|
return self.relatedTo(other, relation: .Equal, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func lessThanOrEqualTo(other: ConstraintRelatableTarget, _ file: String = __FILE__, _ line: UInt = __LINE__) -> ConstraintMakerEditable {
|
||||||
|
return self.relatedTo(other, relation: .LessThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func greaterThanOrEqualTo(other: ConstraintRelatableTarget, _ file: String = __FILE__, line: UInt = __LINE__) -> ConstraintMakerEditable {
|
||||||
|
return self.relatedTo(other, relation: .GreaterThanOrEqual, file: file, line: line)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
var constraintMultiplierTargetValue: CGFloat { get }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return CGFloat(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintMultiplierTarget {
|
||||||
|
|
||||||
|
public var constraintMultiplierTargetValue: CGFloat {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func ==(lhs: ConstraintMultiplierTarget, rhs: ConstraintMultiplierTarget) -> Bool {
|
||||||
|
return lhs.constraintMultiplierTargetValue == rhs.constraintMultiplierTargetValue
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintOffsetTarget: ConstraintConstantTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintOffsetTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintOffsetTarget {
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
var constraintPriorityTargetValue: Float { get }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintPriorityTarget {
|
||||||
|
|
||||||
|
public var constraintPriorityTargetValue: Float {
|
||||||
|
return Float(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func ==(lhs: ConstraintPriorityTarget, rhs: ConstraintPriorityTarget) -> Bool {
|
||||||
|
return lhs.constraintPriorityTargetValue == rhs.constraintPriorityTargetValue
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public protocol ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Int: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UInt: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Float: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Double: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGFloat: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGSize: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension CGPoint: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintInsets: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintItem: ConstraintRelatableTarget {
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConstraintView: ConstraintRelatableTarget {
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,27 +22,27 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to define `NSLayoutRelation`
|
|
||||||
*/
|
|
||||||
internal enum ConstraintRelation: Int {
|
internal enum ConstraintRelation: Int {
|
||||||
case Equal = 1, LessThanOrEqualTo, GreaterThanOrEqualTo
|
case Equal = 1
|
||||||
|
case LessThanOrEqual
|
||||||
|
case GreaterThanOrEqual
|
||||||
|
|
||||||
internal var layoutRelation: NSLayoutRelation {
|
internal var layoutRelation: NSLayoutRelation {
|
||||||
get {
|
get {
|
||||||
switch(self) {
|
switch(self) {
|
||||||
case .LessThanOrEqualTo:
|
case .Equal:
|
||||||
return .LessThanOrEqual
|
|
||||||
case .GreaterThanOrEqualTo:
|
|
||||||
return .GreaterThanOrEqual
|
|
||||||
default:
|
|
||||||
return .Equal
|
return .Equal
|
||||||
|
case .LessThanOrEqual:
|
||||||
|
return .LessThanOrEqual
|
||||||
|
case .GreaterThanOrEqual:
|
||||||
|
return .GreaterThanOrEqual
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public extension ConstraintView {
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_left: ConstraintItem { return self.snp.left }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_top: ConstraintItem { return self.snp.top }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_right: ConstraintItem { return self.snp.right }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_bottom: ConstraintItem { return self.snp.bottom }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_leading: ConstraintItem { return self.snp.leading }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_trailing: ConstraintItem { return self.snp.trailing }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_width: ConstraintItem { return self.snp.width }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_height: ConstraintItem { return self.snp.height }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_centerX: ConstraintItem { return self.snp.centerX }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_centerY: ConstraintItem { return self.snp.centerY }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_baseline: ConstraintItem { return self.snp.baseline }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_topMargin: ConstraintItem { return self.snp.topMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_edges: ConstraintItem { return self.snp.edges }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_size: ConstraintItem { return self.snp.size }
|
||||||
|
|
||||||
|
@available(*, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_center: ConstraintItem { return self.snp.center }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_margins: ConstraintItem { return self.snp.margins }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public func snp_prepareConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
|
return self.snp.prepareConstraints(closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public func snp_makeConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) {
|
||||||
|
self.snp.makeConstraints(closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public func snp_remakeConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) {
|
||||||
|
self.snp.remakeConstraints(closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public func snp_updateConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) {
|
||||||
|
self.snp.updateConstraints(closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public func snp_removeConstraints() {
|
||||||
|
self.snp.removeConstraints()
|
||||||
|
}
|
||||||
|
|
||||||
|
public var snp: ConstraintViewDSL {
|
||||||
|
return ConstraintViewDSL(view: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
public typealias ConstraintView = UIView
|
||||||
|
#else
|
||||||
|
public typealias ConstraintView = NSView
|
||||||
|
#endif
|
|
@ -0,0 +1,56 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
|
public extension ConstraintViewController {
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var topLayoutGuideTop: ConstraintItem {
|
||||||
|
return self.snp.topLayoutGuideTop
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var topLayoutGuideBottom: ConstraintItem {
|
||||||
|
return self.snp.topLayoutGuideBottom
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var bottomLayoutGuideTop: ConstraintItem {
|
||||||
|
return self.snp.bottomLayoutGuideTop
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS, deprecated=0.20.0, message="Please use newer snp.* syntax.")
|
||||||
|
public var bottomLayoutGuideBottom: ConstraintItem {
|
||||||
|
return self.snp.bottomLayoutGuideBottom
|
||||||
|
}
|
||||||
|
|
||||||
|
public var snp: ConstraintViewControllerDSL {
|
||||||
|
return ConstraintViewControllerDSL(viewController: self)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
public typealias ConstraintViewController = UIViewController
|
||||||
|
#else
|
||||||
|
public typealias ConstraintViewController = NSViewController
|
||||||
|
#endif
|
|
@ -0,0 +1,58 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
|
public struct ConstraintViewControllerDSL {
|
||||||
|
|
||||||
|
@available(iOS 7.0, *)
|
||||||
|
public var topLayoutGuideTop: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.viewController.topLayoutGuide, attributes: ConstraintAttributes.Top)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 7.0, *)
|
||||||
|
public var topLayoutGuideBottom: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.viewController.topLayoutGuide, attributes: ConstraintAttributes.Bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 7.0, *)
|
||||||
|
public var bottomLayoutGuideTop: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.viewController.bottomLayoutGuide, attributes: ConstraintAttributes.Top)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 7.0, *)
|
||||||
|
public var bottomLayoutGuideBottom: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.viewController.bottomLayoutGuide, attributes: ConstraintAttributes.Bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal let viewController: ConstraintViewController
|
||||||
|
|
||||||
|
internal init(viewController: ConstraintViewController) {
|
||||||
|
self.viewController = viewController
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,196 @@
|
||||||
|
//
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
|
import UIKit
|
||||||
|
#else
|
||||||
|
import AppKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public struct ConstraintViewDSL {
|
||||||
|
|
||||||
|
public var left: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Left)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var top: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Top)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var right: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Right)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var bottom: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Bottom)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var leading: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var trailing: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Trailing)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var width: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Width)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var height: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Height)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerX: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterX)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var centerY: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterY)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var baseline: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Baseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var firstBaseline: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.FirstBaseline)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leftMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.LeftMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var topMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.TopMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var rightMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.RightMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var bottomMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.BottomMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var leadingMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.LeadingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var trailingMargin: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.TrailingMargin)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerXWithinMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterXWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerYWithinMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterYWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var edges: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Edges)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var size: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Size)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var center: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Center)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var margins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.Margins)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 8.0, *)
|
||||||
|
public var centerWithinMargins: ConstraintItem {
|
||||||
|
return ConstraintItem(target: self.view, attributes: ConstraintAttributes.CenterWithinMargins)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func prepareConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||||
|
return ConstraintMaker.prepareConstraints(view: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func makeConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.makeConstraints(view: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func remakeConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.remakeConstraints(view: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func updateConstraints(@noescape closure closure: (make: ConstraintMaker) -> Void) {
|
||||||
|
ConstraintMaker.updateConstraints(view: self.view, closure: closure)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func removeConstraints() {
|
||||||
|
ConstraintMaker.removeConstraints(view: self.view)
|
||||||
|
}
|
||||||
|
|
||||||
|
public var label: String? {
|
||||||
|
get {
|
||||||
|
return objc_getAssociatedObject(self.view, &labelKey) as? String
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
objc_setAssociatedObject(self.view, &labelKey, newValue, .OBJC_ASSOCIATION_COPY_NONATOMIC)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal let view: ConstraintView
|
||||||
|
|
||||||
|
internal init(view: ConstraintView) {
|
||||||
|
self.view = view
|
||||||
|
}
|
||||||
|
|
||||||
|
internal var installedLayoutConstraints: [LayoutConstraint] {
|
||||||
|
return objc_getAssociatedObject(self.view, &installedLayoutConstraintsKey) as? [LayoutConstraint] ?? []
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func appendInstalledLayoutConstraints(layoutConstraints: [LayoutConstraint]) {
|
||||||
|
var newValue = self.installedLayoutConstraints
|
||||||
|
newValue += layoutConstraints
|
||||||
|
objc_setAssociatedObject(self.view, &installedLayoutConstraintsKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func removeInstalledLayoutConstraints(layoutConstraints: [LayoutConstraint]) {
|
||||||
|
let newValue = self.installedLayoutConstraints.filter { !layoutConstraints.contains($0) }
|
||||||
|
objc_setAssociatedObject(self.view, &installedLayoutConstraintsKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var labelKey: UInt8 = 0
|
||||||
|
private var installedLayoutConstraintsKey: UInt8 = 0
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,41 +22,13 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to allow adding a snp_label to a View for debugging purposes
|
|
||||||
*/
|
|
||||||
public extension View {
|
|
||||||
|
|
||||||
public var snp_label: String? {
|
|
||||||
get {
|
|
||||||
return objc_getAssociatedObject(self, &labelKey) as? String
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
objc_setAssociatedObject(self, &labelKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to allow adding a snp_label to a LayoutConstraint for debugging purposes
|
|
||||||
*/
|
|
||||||
public extension LayoutConstraint {
|
public extension LayoutConstraint {
|
||||||
|
|
||||||
public var snp_label: String? {
|
|
||||||
get {
|
|
||||||
return objc_getAssociatedObject(self, &labelKey) as? String
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
objc_setAssociatedObject(self, &labelKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY_NONATOMIC)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override public var description: String {
|
override public var description: String {
|
||||||
var description = "<"
|
var description = "<"
|
||||||
|
|
||||||
|
@ -64,17 +36,17 @@ public extension LayoutConstraint {
|
||||||
|
|
||||||
description += " \(descriptionForObject(self.firstItem))"
|
description += " \(descriptionForObject(self.firstItem))"
|
||||||
if self.firstAttribute != .NotAnAttribute {
|
if self.firstAttribute != .NotAnAttribute {
|
||||||
description += ".\(self.firstAttribute.snp_description)"
|
description += ".\(descriptionForAttribute(self.firstAttribute))"
|
||||||
}
|
}
|
||||||
|
|
||||||
description += " \(self.relation.snp_description)"
|
description += " \(descriptionForRelation(self.relation))"
|
||||||
|
|
||||||
if let secondItem: AnyObject = self.secondItem {
|
if let secondItem: AnyObject = self.secondItem {
|
||||||
description += " \(descriptionForObject(secondItem))"
|
description += " \(descriptionForObject(secondItem))"
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.secondAttribute != .NotAnAttribute {
|
if self.secondAttribute != .NotAnAttribute {
|
||||||
description += ".\(self.secondAttribute.snp_description)"
|
description += ".\(descriptionForAttribute(self.secondAttribute))"
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.multiplier != 1.0 {
|
if self.multiplier != 1.0 {
|
||||||
|
@ -100,57 +72,19 @@ public extension LayoutConstraint {
|
||||||
return description
|
return description
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var snp_makerFile: String? {
|
|
||||||
return self.snp_constraint?.makerLocation.file
|
|
||||||
}
|
|
||||||
|
|
||||||
internal var snp_makerLine: UInt? {
|
|
||||||
return self.snp_constraint?.makerLocation.line
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var labelKey = ""
|
private func descriptionForRelation(relation: NSLayoutRelation) -> String {
|
||||||
|
switch relation {
|
||||||
private func descriptionForObject(object: AnyObject) -> String {
|
case .Equal: return "=="
|
||||||
let pointerDescription = NSString(format: "%p", ObjectIdentifier(object).uintValue)
|
case .GreaterThanOrEqual: return ">="
|
||||||
var desc = ""
|
case .LessThanOrEqual: return "<="
|
||||||
|
|
||||||
desc += object.dynamicType.description()
|
|
||||||
|
|
||||||
if let object = object as? View {
|
|
||||||
desc += ":\(object.snp_label ?? pointerDescription)"
|
|
||||||
} else if let object = object as? LayoutConstraint {
|
|
||||||
desc += ":\(object.snp_label ?? pointerDescription)"
|
|
||||||
} else {
|
|
||||||
desc += ":\(pointerDescription)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let object = object as? LayoutConstraint, let file = object.snp_makerFile, let line = object.snp_makerLine {
|
|
||||||
desc += "@\(file)#\(line)"
|
|
||||||
}
|
|
||||||
|
|
||||||
desc += ""
|
|
||||||
return desc
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private extension NSLayoutRelation {
|
private func descriptionForAttribute(attribute: NSLayoutAttribute) -> String {
|
||||||
|
#if os(iOS) || os(tvOS)
|
||||||
private var snp_description: String {
|
switch attribute {
|
||||||
switch self {
|
|
||||||
case .Equal: return "=="
|
|
||||||
case .GreaterThanOrEqual: return ">="
|
|
||||||
case .LessThanOrEqual: return "<="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private extension NSLayoutAttribute {
|
|
||||||
|
|
||||||
private var snp_description: String {
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
switch self {
|
|
||||||
case .NotAnAttribute: return "notAnAttribute"
|
case .NotAnAttribute: return "notAnAttribute"
|
||||||
case .Top: return "top"
|
case .Top: return "top"
|
||||||
case .Left: return "left"
|
case .Left: return "left"
|
||||||
|
@ -173,8 +107,8 @@ private extension NSLayoutAttribute {
|
||||||
case .CenterXWithinMargins: return "centerXWithinMargins"
|
case .CenterXWithinMargins: return "centerXWithinMargins"
|
||||||
case .CenterYWithinMargins: return "centerYWithinMargins"
|
case .CenterYWithinMargins: return "centerYWithinMargins"
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
switch self {
|
switch attribute {
|
||||||
case .NotAnAttribute: return "notAnAttribute"
|
case .NotAnAttribute: return "notAnAttribute"
|
||||||
case .Top: return "top"
|
case .Top: return "top"
|
||||||
case .Left: return "left"
|
case .Left: return "left"
|
||||||
|
@ -189,8 +123,27 @@ private extension NSLayoutAttribute {
|
||||||
case .Baseline: return "baseline"
|
case .Baseline: return "baseline"
|
||||||
default: return "default"
|
default: return "default"
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private func descriptionForObject(object: AnyObject) -> String {
|
||||||
|
let pointerDescription = NSString(format: "%p", ObjectIdentifier(object).uintValue)
|
||||||
|
var desc = ""
|
||||||
|
|
||||||
|
desc += object.dynamicType.description()
|
||||||
|
|
||||||
|
if let object = object as? ConstraintView {
|
||||||
|
desc += ":\(object.snp.label ?? pointerDescription)"
|
||||||
|
} else if let object = object as? LayoutConstraint {
|
||||||
|
desc += ":\(object.label ?? pointerDescription)"
|
||||||
|
} else {
|
||||||
|
desc += ":\(pointerDescription)"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 {
|
||||||
|
desc += "@\((file as NSString).lastPathComponent)#\(line)"
|
||||||
|
}
|
||||||
|
|
||||||
|
desc += ""
|
||||||
|
return desc
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// SnapKit
|
// SnapKit
|
||||||
//
|
//
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -22,45 +22,28 @@
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
#if os(iOS) || os(tvOS)
|
||||||
import UIKit
|
import UIKit
|
||||||
#else
|
#else
|
||||||
import AppKit
|
import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Used to add extra information to the actual `NSLayoutConstraint`'s that will UIKit/AppKit will utilize
|
|
||||||
*/
|
|
||||||
public class LayoutConstraint: NSLayoutConstraint {
|
public class LayoutConstraint: NSLayoutConstraint {
|
||||||
|
|
||||||
internal var snp_constraint: Constraint? = nil
|
internal var constraint: Constraint? = nil
|
||||||
|
public var label: String? = nil
|
||||||
|
|
||||||
public var snp_location: SourceLocation? {
|
|
||||||
return snp_constraint?.location
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func ==(left: LayoutConstraint, right: LayoutConstraint) -> Bool {
|
internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
|
||||||
if left.firstItem !== right.firstItem {
|
guard lhs.firstItem === rhs.firstItem &&
|
||||||
return false
|
lhs.secondItem === rhs.secondItem &&
|
||||||
}
|
lhs.firstAttribute == rhs.firstAttribute &&
|
||||||
if left.secondItem !== right.secondItem {
|
lhs.secondAttribute == rhs.secondAttribute &&
|
||||||
return false
|
lhs.relation == rhs.relation &&
|
||||||
}
|
lhs.priority == rhs.priority &&
|
||||||
if left.firstAttribute != right.firstAttribute {
|
lhs.multiplier == rhs.multiplier else {
|
||||||
return false
|
|
||||||
}
|
|
||||||
if left.secondAttribute != right.secondAttribute {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if left.relation != right.relation {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if left.priority != right.priority {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if left.multiplier != right.multiplier {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,183 +0,0 @@
|
||||||
//
|
|
||||||
// SnapKit
|
|
||||||
//
|
|
||||||
// Copyright (c) 2011-2015 SnapKit Team - https://github.com/SnapKit
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
import UIKit
|
|
||||||
public typealias View = UIView
|
|
||||||
#else
|
|
||||||
import AppKit
|
|
||||||
public typealias View = NSView
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used to expose public API on views
|
|
||||||
*/
|
|
||||||
public extension View {
|
|
||||||
|
|
||||||
/// left edge
|
|
||||||
public var snp_left: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Left) }
|
|
||||||
|
|
||||||
/// top edge
|
|
||||||
public var snp_top: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Top) }
|
|
||||||
|
|
||||||
/// right edge
|
|
||||||
public var snp_right: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Right) }
|
|
||||||
|
|
||||||
/// bottom edge
|
|
||||||
public var snp_bottom: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Bottom) }
|
|
||||||
|
|
||||||
/// leading edge
|
|
||||||
public var snp_leading: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Leading) }
|
|
||||||
|
|
||||||
/// trailing edge
|
|
||||||
public var snp_trailing: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Trailing) }
|
|
||||||
|
|
||||||
/// width dimension
|
|
||||||
public var snp_width: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Width) }
|
|
||||||
|
|
||||||
/// height dimension
|
|
||||||
public var snp_height: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Height) }
|
|
||||||
|
|
||||||
/// centerX position
|
|
||||||
public var snp_centerX: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.CenterX) }
|
|
||||||
|
|
||||||
/// centerY position
|
|
||||||
public var snp_centerY: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.CenterY) }
|
|
||||||
|
|
||||||
/// baseline position
|
|
||||||
public var snp_baseline: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Baseline) }
|
|
||||||
|
|
||||||
/// first baseline position
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_firstBaseline: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.FirstBaseline) }
|
|
||||||
|
|
||||||
/// left margin
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_leftMargin: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.LeftMargin) }
|
|
||||||
|
|
||||||
/// right margin
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_rightMargin: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.RightMargin) }
|
|
||||||
|
|
||||||
/// top margin
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_topMargin: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.TopMargin) }
|
|
||||||
|
|
||||||
/// bottom margin
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_bottomMargin: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.BottomMargin) }
|
|
||||||
|
|
||||||
/// leading margin
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_leadingMargin: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.LeadingMargin) }
|
|
||||||
|
|
||||||
/// trailing margin
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_trailingMargin: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.TrailingMargin) }
|
|
||||||
|
|
||||||
/// centerX within margins
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_centerXWithinMargins: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.CenterXWithinMargins) }
|
|
||||||
|
|
||||||
/// centerY within margins
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_centerYWithinMargins: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.CenterYWithinMargins) }
|
|
||||||
|
|
||||||
// top + left + bottom + right edges
|
|
||||||
public var snp_edges: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Edges) }
|
|
||||||
|
|
||||||
// width + height dimensions
|
|
||||||
public var snp_size: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Size) }
|
|
||||||
|
|
||||||
// centerX + centerY positions
|
|
||||||
public var snp_center: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Center) }
|
|
||||||
|
|
||||||
// top + left + bottom + right margins
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_margins: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.Margins) }
|
|
||||||
|
|
||||||
// centerX + centerY within margins
|
|
||||||
@available(iOS 8.0, *)
|
|
||||||
public var snp_centerWithinMargins: ConstraintItem { return ConstraintItem(object: self, attributes: ConstraintAttributes.CenterWithinMargins) }
|
|
||||||
|
|
||||||
/**
|
|
||||||
Prepares constraints with a `ConstraintMaker` and returns the made constraints but does not install them.
|
|
||||||
|
|
||||||
:param: closure that will be passed the `ConstraintMaker` to make the constraints with
|
|
||||||
|
|
||||||
:returns: the constraints made
|
|
||||||
*/
|
|
||||||
public func snp_prepareConstraints(file: String = __FILE__, line: UInt = __LINE__, @noescape closure: (make: ConstraintMaker) -> Void) -> [Constraint] {
|
|
||||||
return ConstraintMaker.prepareConstraints(view: self, location: SourceLocation(file: file, line: line), closure: closure)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Makes constraints with a `ConstraintMaker` and installs them along side any previous made constraints.
|
|
||||||
|
|
||||||
:param: closure that will be passed the `ConstraintMaker` to make the constraints with
|
|
||||||
*/
|
|
||||||
public func snp_makeConstraints(file: String = __FILE__, line: UInt = __LINE__, @noescape closure: (make: ConstraintMaker) -> Void) -> Void {
|
|
||||||
ConstraintMaker.makeConstraints(view: self, location: SourceLocation(file: file, line: line), closure: closure)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Updates constraints with a `ConstraintMaker` that will replace existing constraints that match and install new ones.
|
|
||||||
|
|
||||||
For constraints to match only the constant can be updated.
|
|
||||||
|
|
||||||
:param: closure that will be passed the `ConstraintMaker` to update the constraints with
|
|
||||||
*/
|
|
||||||
public func snp_updateConstraints(file: String = __FILE__, line: UInt = __LINE__, @noescape closure: (make: ConstraintMaker) -> Void) -> Void {
|
|
||||||
ConstraintMaker.updateConstraints(view: self, location: SourceLocation(file: file, line: line), closure: closure)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Remakes constraints with a `ConstraintMaker` that will first remove all previously made constraints and make and install new ones.
|
|
||||||
|
|
||||||
:param: closure that will be passed the `ConstraintMaker` to remake the constraints with
|
|
||||||
*/
|
|
||||||
public func snp_remakeConstraints(file: String = __FILE__, line: UInt = __LINE__, @noescape closure: (make: ConstraintMaker) -> Void) -> Void {
|
|
||||||
ConstraintMaker.remakeConstraints(view: self, location: SourceLocation(file: file, line: line), closure: closure)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Removes all previously made constraints.
|
|
||||||
*/
|
|
||||||
public func snp_removeConstraints() {
|
|
||||||
ConstraintMaker.removeConstraints(view: self)
|
|
||||||
}
|
|
||||||
|
|
||||||
internal var snp_installedLayoutConstraints: [LayoutConstraint] {
|
|
||||||
get {
|
|
||||||
if let constraints = objc_getAssociatedObject(self, &installedLayoutConstraintsKey) as? [LayoutConstraint] {
|
|
||||||
return constraints
|
|
||||||
}
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
objc_setAssociatedObject(self, &installedLayoutConstraintsKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var installedLayoutConstraintsKey = ""
|
|
|
@ -29,202 +29,4 @@ class SnapKitTests: XCTestCase {
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testLayoutGuideConstraints() {
|
|
||||||
#if os(iOS) || os(tvOS)
|
|
||||||
let vc = UIViewController()
|
|
||||||
vc.view = UIView(frame: CGRectMake(0, 0, 300, 300))
|
|
||||||
|
|
||||||
vc.view.addSubview(self.container)
|
|
||||||
|
|
||||||
self.container.snp_makeConstraints { (make) -> Void in
|
|
||||||
make.top.equalTo(vc.snp_topLayoutGuideBottom)
|
|
||||||
make.bottom.equalTo(vc.snp_bottomLayoutGuideTop)
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(vc.view.snp_constraints.count, 6, "Should have 6 constraints installed")
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
func testMakeConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
v1.snp_makeConstraints { (make) -> Void in
|
|
||||||
make.top.equalTo(v2.snp_top).offset(50)
|
|
||||||
make.left.equalTo(v2.snp_top).offset(50)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints installed")
|
|
||||||
|
|
||||||
v2.snp_makeConstraints { (make) -> Void in
|
|
||||||
make.edges.equalTo(v1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 6, "Should have 6 constraints installed")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func testUpdateConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
v1.snp_makeConstraints { (make) -> Void in
|
|
||||||
make.top.equalTo(v2.snp_top).offset(50)
|
|
||||||
make.left.equalTo(v2.snp_top).offset(50)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints installed")
|
|
||||||
|
|
||||||
v1.snp_updateConstraints { (make) -> Void in
|
|
||||||
make.top.equalTo(v2.snp_top).offset(15)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should still have 2 constraints installed")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func testRemakeConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
v1.snp_makeConstraints { (make) -> Void in
|
|
||||||
make.top.equalTo(v2.snp_top).offset(50)
|
|
||||||
make.left.equalTo(v2.snp_top).offset(50)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints installed")
|
|
||||||
|
|
||||||
v1.snp_remakeConstraints { (make) -> Void in
|
|
||||||
make.edges.equalTo(v2)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints installed")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func testRemoveConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
v1.snp_makeConstraints { (make) -> Void in
|
|
||||||
make.top.equalTo(v2.snp_top).offset(50)
|
|
||||||
make.left.equalTo(v2.snp_top).offset(50)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints installed")
|
|
||||||
|
|
||||||
v1.snp_removeConstraints()
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints installed")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func testPrepareConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
let constraints = v1.snp_prepareConstraints { (make) -> Void in
|
|
||||||
make.edges.equalTo(v2)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints installed")
|
|
||||||
|
|
||||||
for constraint in constraints {
|
|
||||||
constraint.install()
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints installed")
|
|
||||||
|
|
||||||
for constraint in constraints {
|
|
||||||
constraint.uninstall()
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints installed")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func testReinstallConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
let constraints = v1.snp_prepareConstraints { (make) -> Void in
|
|
||||||
make.edges.equalTo(v2)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints installed")
|
|
||||||
|
|
||||||
for constraint in constraints {
|
|
||||||
constraint.install()
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 4 constraints installed")
|
|
||||||
|
|
||||||
for constraint in constraints {
|
|
||||||
constraint.install()
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 4, "Should have 0 constraints installed")
|
|
||||||
}
|
|
||||||
|
|
||||||
func testActivateDeactivateConstraints() {
|
|
||||||
let v1 = View()
|
|
||||||
let v2 = View()
|
|
||||||
self.container.addSubview(v1)
|
|
||||||
self.container.addSubview(v2)
|
|
||||||
|
|
||||||
var c1: Constraint? = nil
|
|
||||||
var c2: Constraint? = nil
|
|
||||||
|
|
||||||
v1.snp_prepareConstraints { (make) -> Void in
|
|
||||||
c1 = make.top.equalTo(v2.snp_top).offset(50).constraint
|
|
||||||
c2 = make.left.equalTo(v2.snp_top).offset(50).constraint
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints")
|
|
||||||
|
|
||||||
c1?.activate()
|
|
||||||
c2?.activate()
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints")
|
|
||||||
|
|
||||||
c1?.deactivate()
|
|
||||||
c2?.deactivate()
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints")
|
|
||||||
|
|
||||||
c1?.uninstall()
|
|
||||||
c2?.uninstall()
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 0, "Should have 0 constraints")
|
|
||||||
|
|
||||||
c1?.activate()
|
|
||||||
c2?.activate()
|
|
||||||
|
|
||||||
XCTAssertEqual(self.container.snp_constraints.count, 2, "Should have 2 constraints")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue