Explorar o código

initial commit

Jonas Budelmann %!s(int64=12) %!d(string=hai) anos
achega
866db51912
Modificáronse 40 ficheiros con 2716 adicións e 0 borrados
  1. 19 0
      .gitignore
  2. 553 0
      Masonry.xcodeproj/project.pbxproj
  3. 69 0
      Masonry.xcodeproj/xcshareddata/xcschemes/Masonry.xcscheme
  4. 26 0
      Masonry/MASCompositeConstraint.h
  5. 177 0
      Masonry/MASCompositeConstraint.m
  6. 31 0
      Masonry/MASConstraint.h
  7. 33 0
      Masonry/MASConstraintBuilder.h
  8. 121 0
      Masonry/MASConstraintBuilder.m
  9. 20 0
      Masonry/MASViewAttribute.h
  10. 27 0
      Masonry/MASViewAttribute.m
  11. 20 0
      Masonry/MASViewConstraint.h
  12. 259 0
      Masonry/MASViewConstraint.m
  13. 14 0
      Masonry/Masonry-Prefix.pch
  14. 11 0
      Masonry/Masonry.h
  15. 52 0
      Masonry/UIView+MASAdditions.h
  16. 91 0
      Masonry/UIView+MASAdditions.m
  17. 347 0
      MasonryExamples/MasonryExamples.xcodeproj/project.pbxproj
  18. 100 0
      MasonryExamples/MasonryExamples.xcodeproj/xcshareddata/xcschemes/MasonryExamples.xcscheme
  19. 15 0
      MasonryExamples/MasonryExamples/MASAppDelegate.h
  20. 25 0
      MasonryExamples/MasonryExamples/MASAppDelegate.m
  21. 13 0
      MasonryExamples/MasonryExamples/MASExampleBasicView.h
  22. 78 0
      MasonryExamples/MasonryExamples/MASExampleBasicView.m
  23. 13 0
      MasonryExamples/MasonryExamples/MASExampleConstantsView.h
  24. 48 0
      MasonryExamples/MasonryExamples/MASExampleConstantsView.m
  25. 13 0
      MasonryExamples/MasonryExamples/MASExampleListViewController.h
  26. 66 0
      MasonryExamples/MasonryExamples/MASExampleListViewController.m
  27. 13 0
      MasonryExamples/MasonryExamples/MASExampleSidesView.h
  28. 42 0
      MasonryExamples/MasonryExamples/MASExampleSidesView.m
  29. 15 0
      MasonryExamples/MasonryExamples/MASExampleViewController.h
  30. 34 0
      MasonryExamples/MasonryExamples/MASExampleViewController.m
  31. 45 0
      MasonryExamples/MasonryExamples/MasonryExamples-Info.plist
  32. 18 0
      MasonryExamples/MasonryExamples/MasonryExamples-Prefix.pch
  33. 2 0
      MasonryExamples/MasonryExamples/en.lproj/InfoPlist.strings
  34. 18 0
      MasonryExamples/MasonryExamples/main.m
  35. 59 0
      MasonryTests/MASCompositeConstraintSpec.m
  36. 178 0
      MasonryTests/MASViewConstraintSpec.m
  37. 22 0
      MasonryTests/MasonryTests-Info.plist
  38. 20 0
      MasonryTests/MasonryTests-Prefix.pch
  39. 2 0
      MasonryTests/en.lproj/InfoPlist.strings
  40. 7 0
      Podfile

+ 19 - 0
.gitignore

@@ -0,0 +1,19 @@
+# Xcode
+build/*
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+*.xcworkspace
+!default.xcworkspace
+xcuserdata
+profile
+*.moved-aside
+# Desktop Servies
+.DS_Store
+Podfile.lock
+/Pods/

+ 553 - 0
Masonry.xcodeproj/project.pbxproj

@@ -0,0 +1,553 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		DD52F1AE179CA93B005CD195 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F1AD179CA93B005CD195 /* Foundation.framework */; };
+		DD52F1BD179CA93B005CD195 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F1BC179CA93B005CD195 /* SenTestingKit.framework */; };
+		DD52F1BF179CA93B005CD195 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F1BE179CA93B005CD195 /* UIKit.framework */; };
+		DD52F1C0179CA93B005CD195 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F1AD179CA93B005CD195 /* Foundation.framework */; };
+		DD52F1C3179CA93B005CD195 /* libMasonry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F1AA179CA93B005CD195 /* libMasonry.a */; };
+		DD52F1C9179CA93B005CD195 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DD52F1C7179CA93B005CD195 /* InfoPlist.strings */; };
+		DD52F1DA179CAA9C005CD195 /* MASCompositeConstraintSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1D8179CAA9C005CD195 /* MASCompositeConstraintSpec.m */; };
+		DD52F1DB179CAA9C005CD195 /* MASViewConstraintSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1D9179CAA9C005CD195 /* MASViewConstraintSpec.m */; };
+		DD52F1E7179CAACA005CD195 /* MASCompositeConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1DD179CAACA005CD195 /* MASCompositeConstraint.m */; };
+		DD52F1E8179CAACA005CD195 /* MASConstraintBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1E0179CAACA005CD195 /* MASConstraintBuilder.m */; };
+		DD52F1E9179CAACA005CD195 /* MASViewAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1E2179CAACA005CD195 /* MASViewAttribute.m */; };
+		DD52F1EA179CAACA005CD195 /* MASViewConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1E4179CAACA005CD195 /* MASViewConstraint.m */; };
+		DD52F1EB179CAACA005CD195 /* UIView+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */; };
+		DD52F264179CB327005CD195 /* Masonry.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1ED179CAAEE005CD195 /* Masonry.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DD52F265179CB32B005CD195 /* UIView+MASAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DD52F266179CB33F005CD195 /* MASConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1DE179CAACA005CD195 /* MASConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DD52F267179CB342005CD195 /* MASConstraintBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1DF179CAACA005CD195 /* MASConstraintBuilder.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DD52F269179CB34A005CD195 /* MASViewConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DD52F26A179CB365005CD195 /* MASCompositeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1DC179CAACA005CD195 /* MASCompositeConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		F0D61B353FCC42358F962A3C /* libPods-MasonryTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		DD52F1C1179CA93B005CD195 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = DD52F1A2179CA93B005CD195 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = DD52F1A9179CA93B005CD195;
+			remoteInfo = Masonry;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		DD52F1A8179CA93B005CD195 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = "include/${PRODUCT_NAME}";
+			dstSubfolderSpec = 16;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		CC61B4599FE44F12AD607E9B /* Pods-MasonryTests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MasonryTests.xcconfig"; path = "Pods/Pods-MasonryTests.xcconfig"; sourceTree = SOURCE_ROOT; };
+		DD52F1AA179CA93B005CD195 /* libMasonry.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMasonry.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		DD52F1AD179CA93B005CD195 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+		DD52F1B1179CA93B005CD195 /* Masonry-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Masonry-Prefix.pch"; sourceTree = "<group>"; };
+		DD52F1BB179CA93B005CD195 /* MasonryTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MasonryTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+		DD52F1BC179CA93B005CD195 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
+		DD52F1BE179CA93B005CD195 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+		DD52F1C6179CA93B005CD195 /* MasonryTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MasonryTests-Info.plist"; sourceTree = "<group>"; };
+		DD52F1C8179CA93B005CD195 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		DD52F1D6179CAA71005CD195 /* MasonryTests-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MasonryTests-Prefix.pch"; sourceTree = "<group>"; };
+		DD52F1D8179CAA9C005CD195 /* MASCompositeConstraintSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASCompositeConstraintSpec.m; sourceTree = "<group>"; };
+		DD52F1D9179CAA9C005CD195 /* MASViewConstraintSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewConstraintSpec.m; sourceTree = "<group>"; };
+		DD52F1DC179CAACA005CD195 /* MASCompositeConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASCompositeConstraint.h; sourceTree = "<group>"; };
+		DD52F1DD179CAACA005CD195 /* MASCompositeConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASCompositeConstraint.m; sourceTree = "<group>"; };
+		DD52F1DE179CAACA005CD195 /* MASConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASConstraint.h; sourceTree = "<group>"; };
+		DD52F1DF179CAACA005CD195 /* MASConstraintBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASConstraintBuilder.h; sourceTree = "<group>"; };
+		DD52F1E0179CAACA005CD195 /* MASConstraintBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASConstraintBuilder.m; sourceTree = "<group>"; };
+		DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASViewAttribute.h; sourceTree = "<group>"; };
+		DD52F1E2179CAACA005CD195 /* MASViewAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewAttribute.m; sourceTree = "<group>"; };
+		DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASViewConstraint.h; sourceTree = "<group>"; };
+		DD52F1E4179CAACA005CD195 /* MASViewConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewConstraint.m; sourceTree = "<group>"; };
+		DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASAdditions.h"; sourceTree = "<group>"; };
+		DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MASAdditions.m"; sourceTree = "<group>"; };
+		DD52F1ED179CAAEE005CD195 /* Masonry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Masonry.h; sourceTree = "<group>"; };
+		DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MasonryTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		DD52F1A7179CA93B005CD195 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F1AE179CA93B005CD195 /* Foundation.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		DD52F1B7179CA93B005CD195 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F1BD179CA93B005CD195 /* SenTestingKit.framework in Frameworks */,
+				DD52F1BF179CA93B005CD195 /* UIKit.framework in Frameworks */,
+				DD52F1C0179CA93B005CD195 /* Foundation.framework in Frameworks */,
+				DD52F1C3179CA93B005CD195 /* libMasonry.a in Frameworks */,
+				F0D61B353FCC42358F962A3C /* libPods-MasonryTests.a in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		DD52F1A1179CA93B005CD195 = {
+			isa = PBXGroup;
+			children = (
+				DD52F1AF179CA93B005CD195 /* Masonry */,
+				DD52F1C4179CA93B005CD195 /* MasonryTests */,
+				DD52F1AC179CA93B005CD195 /* Frameworks */,
+				DD52F1AB179CA93B005CD195 /* Products */,
+				CC61B4599FE44F12AD607E9B /* Pods-MasonryTests.xcconfig */,
+			);
+			sourceTree = "<group>";
+		};
+		DD52F1AB179CA93B005CD195 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1AA179CA93B005CD195 /* libMasonry.a */,
+				DD52F1BB179CA93B005CD195 /* MasonryTests.octest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		DD52F1AC179CA93B005CD195 /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1AD179CA93B005CD195 /* Foundation.framework */,
+				DD52F1BC179CA93B005CD195 /* SenTestingKit.framework */,
+				DD52F1BE179CA93B005CD195 /* UIKit.framework */,
+				DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+		DD52F1AF179CA93B005CD195 /* Masonry */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1ED179CAAEE005CD195 /* Masonry.h */,
+				DD52F1EC179CAACF005CD195 /* Additions */,
+				DD52F1EE179CAAF3005CD195 /* Modules */,
+				DD52F1B0179CA93B005CD195 /* Supporting Files */,
+			);
+			path = Masonry;
+			sourceTree = "<group>";
+		};
+		DD52F1B0179CA93B005CD195 /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1B1179CA93B005CD195 /* Masonry-Prefix.pch */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+		DD52F1C4179CA93B005CD195 /* MasonryTests */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1D7179CAA78005CD195 /* Specs */,
+				DD52F1C5179CA93B005CD195 /* Supporting Files */,
+			);
+			path = MasonryTests;
+			sourceTree = "<group>";
+		};
+		DD52F1C5179CA93B005CD195 /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1D6179CAA71005CD195 /* MasonryTests-Prefix.pch */,
+				DD52F1C6179CA93B005CD195 /* MasonryTests-Info.plist */,
+				DD52F1C7179CA93B005CD195 /* InfoPlist.strings */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+		DD52F1D7179CAA78005CD195 /* Specs */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1D8179CAA9C005CD195 /* MASCompositeConstraintSpec.m */,
+				DD52F1D9179CAA9C005CD195 /* MASViewConstraintSpec.m */,
+			);
+			name = Specs;
+			sourceTree = "<group>";
+		};
+		DD52F1EC179CAACF005CD195 /* Additions */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */,
+				DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */,
+			);
+			name = Additions;
+			sourceTree = "<group>";
+		};
+		DD52F1EE179CAAF3005CD195 /* Modules */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F1DE179CAACA005CD195 /* MASConstraint.h */,
+				DD52F1DC179CAACA005CD195 /* MASCompositeConstraint.h */,
+				DD52F1DD179CAACA005CD195 /* MASCompositeConstraint.m */,
+				DD52F1DF179CAACA005CD195 /* MASConstraintBuilder.h */,
+				DD52F1E0179CAACA005CD195 /* MASConstraintBuilder.m */,
+				DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */,
+				DD52F1E2179CAACA005CD195 /* MASViewAttribute.m */,
+				DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */,
+				DD52F1E4179CAACA005CD195 /* MASViewConstraint.m */,
+			);
+			name = Modules;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		DD52F263179CB30B005CD195 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F264179CB327005CD195 /* Masonry.h in Headers */,
+				DD52F265179CB32B005CD195 /* UIView+MASAdditions.h in Headers */,
+				DD52F266179CB33F005CD195 /* MASConstraint.h in Headers */,
+				DD52F267179CB342005CD195 /* MASConstraintBuilder.h in Headers */,
+				DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */,
+				DD52F269179CB34A005CD195 /* MASViewConstraint.h in Headers */,
+				DD52F26A179CB365005CD195 /* MASCompositeConstraint.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		DD52F1A9179CA93B005CD195 /* Masonry */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = DD52F1CF179CA93B005CD195 /* Build configuration list for PBXNativeTarget "Masonry" */;
+			buildPhases = (
+				DD52F1A6179CA93B005CD195 /* Sources */,
+				DD52F1A7179CA93B005CD195 /* Frameworks */,
+				DD52F263179CB30B005CD195 /* Headers */,
+				DD52F1A8179CA93B005CD195 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = Masonry;
+			productName = Masonry;
+			productReference = DD52F1AA179CA93B005CD195 /* libMasonry.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		DD52F1BA179CA93B005CD195 /* MasonryTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = DD52F1D2179CA93B005CD195 /* Build configuration list for PBXNativeTarget "MasonryTests" */;
+			buildPhases = (
+				AC8F7DDB52CD41F48C935F77 /* Check Pods Manifest.lock */,
+				DD52F1B6179CA93B005CD195 /* Sources */,
+				DD52F1B7179CA93B005CD195 /* Frameworks */,
+				DD52F1B8179CA93B005CD195 /* Resources */,
+				DD52F1B9179CA93B005CD195 /* ShellScript */,
+				4FA4ADCF00674C1E96148528 /* Copy Pods Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				DD52F1C2179CA93B005CD195 /* PBXTargetDependency */,
+			);
+			name = MasonryTests;
+			productName = MasonryTests;
+			productReference = DD52F1BB179CA93B005CD195 /* MasonryTests.octest */;
+			productType = "com.apple.product-type.bundle";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		DD52F1A2179CA93B005CD195 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0460;
+				ORGANIZATIONNAME = "Jonas Budelmann";
+			};
+			buildConfigurationList = DD52F1A5179CA93B005CD195 /* Build configuration list for PBXProject "Masonry" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = DD52F1A1179CA93B005CD195;
+			productRefGroup = DD52F1AB179CA93B005CD195 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				DD52F1A9179CA93B005CD195 /* Masonry */,
+				DD52F1BA179CA93B005CD195 /* MasonryTests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		DD52F1B8179CA93B005CD195 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F1C9179CA93B005CD195 /* InfoPlist.strings in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		4FA4ADCF00674C1E96148528 /* Copy Pods Resources */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			name = "Copy Pods Resources";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "\"${SRCROOT}/Pods/Pods-MasonryTests-resources.sh\"\n";
+		};
+		AC8F7DDB52CD41F48C935F77 /* Check Pods Manifest.lock */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			name = "Check Pods Manifest.lock";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n    cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n    exit 1\nfi\n";
+		};
+		DD52F1B9179CA93B005CD195 /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		DD52F1A6179CA93B005CD195 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F1E7179CAACA005CD195 /* MASCompositeConstraint.m in Sources */,
+				DD52F1E8179CAACA005CD195 /* MASConstraintBuilder.m in Sources */,
+				DD52F1E9179CAACA005CD195 /* MASViewAttribute.m in Sources */,
+				DD52F1EA179CAACA005CD195 /* MASViewConstraint.m in Sources */,
+				DD52F1EB179CAACA005CD195 /* UIView+MASAdditions.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		DD52F1B6179CA93B005CD195 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F1DA179CAA9C005CD195 /* MASCompositeConstraintSpec.m in Sources */,
+				DD52F1DB179CAA9C005CD195 /* MASViewConstraintSpec.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		DD52F1C2179CA93B005CD195 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = DD52F1A9179CA93B005CD195 /* Masonry */;
+			targetProxy = DD52F1C1179CA93B005CD195 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+		DD52F1C7179CA93B005CD195 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				DD52F1C8179CA93B005CD195 /* en */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		DD52F1CD179CA93B005CD195 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
+				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				ONLY_ACTIVE_ARCH = NO;
+				PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				SKIP_INSTALL = YES;
+				VALID_ARCHS = "armv7 armv7s i386";
+			};
+			name = Debug;
+		};
+		DD52F1CE179CA93B005CD195 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
+				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				SKIP_INSTALL = YES;
+				VALIDATE_PRODUCT = YES;
+				VALID_ARCHS = "armv7 armv7s i386";
+			};
+			name = Release;
+		};
+		DD52F1D0179CA93B005CD195 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				DSTROOT = /tmp/Masonry.dst;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
+				OTHER_LDFLAGS = (
+					"-ObjC",
+					"-all_load",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+			};
+			name = Debug;
+		};
+		DD52F1D1179CA93B005CD195 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				DSTROOT = /tmp/Masonry.dst;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
+				OTHER_LDFLAGS = (
+					"-ObjC",
+					"-all_load",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SKIP_INSTALL = YES;
+			};
+			name = Release;
+		};
+		DD52F1D3179CA93B005CD195 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = CC61B4599FE44F12AD607E9B /* Pods-MasonryTests.xcconfig */;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = (
+					"\"$(SDKROOT)/Developer/Library/Frameworks\"",
+					"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
+					"$(inherited)",
+				);
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "MasonryTests/MasonryTests-Prefix.pch";
+				INFOPLIST_FILE = "MasonryTests/MasonryTests-Info.plist";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				WRAPPER_EXTENSION = octest;
+			};
+			name = Debug;
+		};
+		DD52F1D4179CA93B005CD195 /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = CC61B4599FE44F12AD607E9B /* Pods-MasonryTests.xcconfig */;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = (
+					"\"$(SDKROOT)/Developer/Library/Frameworks\"",
+					"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
+					"$(inherited)",
+				);
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "MasonryTests/MasonryTests-Prefix.pch";
+				INFOPLIST_FILE = "MasonryTests/MasonryTests-Info.plist";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				WRAPPER_EXTENSION = octest;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		DD52F1A5179CA93B005CD195 /* Build configuration list for PBXProject "Masonry" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DD52F1CD179CA93B005CD195 /* Debug */,
+				DD52F1CE179CA93B005CD195 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		DD52F1CF179CA93B005CD195 /* Build configuration list for PBXNativeTarget "Masonry" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DD52F1D0179CA93B005CD195 /* Debug */,
+				DD52F1D1179CA93B005CD195 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		DD52F1D2179CA93B005CD195 /* Build configuration list for PBXNativeTarget "MasonryTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DD52F1D3179CA93B005CD195 /* Debug */,
+				DD52F1D4179CA93B005CD195 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = DD52F1A2179CA93B005CD195 /* Project object */;
+}

+ 69 - 0
Masonry.xcodeproj/xcshareddata/xcschemes/Masonry.xcscheme

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0460"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "DD52F1A9179CA93B005CD195"
+               BuildableName = "libMasonry.a"
+               BlueprintName = "Masonry"
+               ReferencedContainer = "container:Masonry.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "DD52F1BA179CA93B005CD195"
+               BuildableName = "MasonryTests.octest"
+               BlueprintName = "MasonryTests"
+               ReferencedContainer = "container:Masonry.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </Testables>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 26 - 0
Masonry/MASCompositeConstraint.h

@@ -0,0 +1,26 @@
+//
+//  MASCompositeConstraint.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MASConstraint.h"
+
+typedef NS_ENUM(NSInteger, MASCompositeViewConstraintType) {
+    MASCompositeViewConstraintTypeSides,
+    MASCompositeViewConstraintTypeSize,
+    MASCompositeViewConstraintTypeCenter,
+};
+
+@interface MASCompositeConstraint : NSObject <MASConstraint>
+
+@property (nonatomic, weak) id<MASConstraintDelegate> delegate;
+@property (nonatomic, strong, readonly) UIView *view;
+@property (nonatomic, assign, readonly) MASCompositeViewConstraintType type;
+
+- (id)initWithView:(UIView *)view type:(MASCompositeViewConstraintType)type;
+
+@end

+ 177 - 0
Masonry/MASCompositeConstraint.m

@@ -0,0 +1,177 @@
+//
+//  MASCompositeConstraint.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASCompositeConstraint.h"
+#import "UIView+MASAdditions.h"
+#import "MASViewConstraint.h"
+
+@interface MASCompositeConstraint () <MASConstraintDelegate>
+
+@property (nonatomic, strong) NSMutableArray *completedChildConstraints;
+@property (nonatomic, strong) NSMutableArray *currentChildConstraints;
+
+@end
+
+@implementation MASCompositeConstraint
+
+- (id)initWithView:(UIView *)view type:(MASCompositeViewConstraintType)type {
+    self = [super init];
+    if (!self) return nil;
+    
+    _view = view;
+    _type = type;
+    
+    self.completedChildConstraints = NSMutableArray.array;
+    [self createChildren];
+    
+    return self;
+}
+
+- (void)createChildren {
+    self.currentChildConstraints = NSMutableArray.array;
+    
+    NSArray *viewAttributes;
+    switch (self.type) {
+        case MASCompositeViewConstraintTypeSides:
+            viewAttributes = @[
+                self.view.mas_left, self.view.mas_top,
+                self.view.mas_bottom, self.view.mas_right
+            ];
+            break;
+        case MASCompositeViewConstraintTypeSize:
+            viewAttributes = @[
+                self.view.mas_width, self.view.mas_height
+            ];
+            break;
+        case MASCompositeViewConstraintTypeCenter:
+            viewAttributes = @[
+                self.view.mas_centerX, self.view.mas_centerY
+            ];
+            break;
+    }
+    
+    for (MASViewAttribute *viewAttribute in viewAttributes) {
+        MASViewConstraint *child = [[MASViewConstraint alloc] initWithFirstViewAttribute:viewAttribute];
+        child.delegate = self;
+        [self.currentChildConstraints addObject:child];
+    }
+}
+
+#pragma mark - MASConstraintDelegate
+
+- (void)addConstraint:(id<MASConstraint>)constraint {
+    //TODO fixme
+    if (![self.currentChildConstraints containsObject:constraint]) {
+        [self.currentChildConstraints addObject:constraint];
+    }
+}
+
+#pragma mark - layout constant
+
+- (id<MASConstraint> (^)(UIEdgeInsets))insets {
+    return ^id(UIEdgeInsets insets) {
+        for (id<MASConstraint> constraint in self.currentChildConstraints) {
+            constraint.insets(insets);
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(CGFloat))offset {
+    return ^id(CGFloat offset) {
+        for (id<MASConstraint> constraint in self.currentChildConstraints) {
+            constraint.offset(offset);
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(CGSize))sizeOffset {
+    return ^id(CGSize offset) {
+        for (id<MASConstraint> constraint in self.currentChildConstraints) {
+            constraint.sizeOffset(offset);
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(CGPoint))centerOffset {
+    return ^id(CGPoint offset) {
+        for (id<MASConstraint> constraint in self.currentChildConstraints) {
+            constraint.centerOffset(offset);
+        }
+        return self;
+    };
+}
+
+#pragma mark - layout multiplier
+
+- (id<MASConstraint> (^)(CGFloat))percent {
+    return ^id(CGFloat percent) {
+        for (id<MASConstraint> constraint in self.currentChildConstraints) {
+            constraint.percent(percent);
+        }
+        return self;
+    };
+}
+
+#pragma mark - layout priority
+
+- (id<MASConstraint> (^)(UILayoutPriority))priority {
+    return ^id(UILayoutPriority priority) {
+        for (id<MASConstraint> constraint in self.currentChildConstraints) {
+            constraint.priority(priority);
+        }
+        return self;
+    };
+}
+
+#pragma mark - layout relation
+
+- (id<MASConstraint> (^)(id))equalityWithBlock:(id<MASConstraint> (^)(id<MASConstraint> constraint, id attr))block {
+    return ^id(id attr) {
+        [self.delegate addConstraint:self]; //TODO make sure we dont add more than once
+        for (id<MASConstraint> constraint in self.currentChildConstraints.copy) {
+            //TODO fixme
+            id<MASConstraint> newConstraint = block(constraint, attr);
+            //if (newConstraint != constraint) { //TODO fix
+                //[self.currentChildConstraints removeObject:constraint];
+                [self.completedChildConstraints addObject:newConstraint];
+            //}
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(id))equal {
+    return [self equalityWithBlock:^id(id<MASConstraint> constraint, id attr) {
+        return constraint.equal(attr);
+    }];
+}
+
+- (id<MASConstraint> (^)(id))greaterThanOrEqual {
+    return [self equalityWithBlock:^id<MASConstraint>(id<MASConstraint> constraint, id attr) {
+        return constraint.greaterThanOrEqual(attr);
+    }];
+}
+
+- (id<MASConstraint> (^)(id))lessThanOrEqual {
+    return [self equalityWithBlock:^id<MASConstraint>(id<MASConstraint> constraint, id attr) {
+        return constraint.lessThanOrEqual(attr);
+    }];
+}
+
+#pragma mark - MASConstraint
+
+- (void)commit {
+    for (id<MASConstraint> constraint in self.completedChildConstraints) {
+        [constraint commit];
+    }
+}
+
+@end

+ 31 - 0
Masonry/MASConstraint.h

@@ -0,0 +1,31 @@
+//
+//  MASConstraint.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 22/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@protocol MASConstraint <NSObject>
+
+@property (nonatomic, strong, readonly) id<MASConstraint> (^insets)(UIEdgeInsets insets);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^sizeOffset)(CGSize offset);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^centerOffset)(CGPoint offset);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^offset)(CGFloat offset);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^percent)(CGFloat percent);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^priority)(UILayoutPriority priority);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^equal)(id attr);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^greaterThanOrEqual)(id attr);
+@property (nonatomic, strong, readonly) id<MASConstraint> (^lessThanOrEqual)(id attr);
+
+- (void)commit;
+
+@end
+
+@protocol MASConstraintDelegate <NSObject>
+
+- (void)addConstraint:(id<MASConstraint>)constraint;
+
+@end

+ 33 - 0
Masonry/MASConstraintBuilder.h

@@ -0,0 +1,33 @@
+//
+//  MASConstraintBuilder.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MASConstraint.h"
+
+@interface MASConstraintBuilder : NSObject
+
+@property (nonatomic, strong, readonly) id<MASConstraint> left;
+@property (nonatomic, strong, readonly) id<MASConstraint> top;
+@property (nonatomic, strong, readonly) id<MASConstraint> right;
+@property (nonatomic, strong, readonly) id<MASConstraint> bottom;
+@property (nonatomic, strong, readonly) id<MASConstraint> leading;
+@property (nonatomic, strong, readonly) id<MASConstraint> trailing;
+@property (nonatomic, strong, readonly) id<MASConstraint> width;
+@property (nonatomic, strong, readonly) id<MASConstraint> height;
+@property (nonatomic, strong, readonly) id<MASConstraint> centerX;
+@property (nonatomic, strong, readonly) id<MASConstraint> centerY;
+@property (nonatomic, strong, readonly) id<MASConstraint> baseline;
+
+@property (nonatomic, strong, readonly) id<MASConstraint> sides;
+@property (nonatomic, strong, readonly) id<MASConstraint> size;
+@property (nonatomic, strong, readonly) id<MASConstraint> center;
+
+- (id)initWithView:(UIView *)view;
+- (void)commit;
+
+@end

+ 121 - 0
Masonry/MASConstraintBuilder.m

@@ -0,0 +1,121 @@
+//
+//  MASConstraintBuilder.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASConstraintBuilder.h"
+#import "MASViewConstraint.h"
+#import "MASCompositeConstraint.h"
+#import "MASViewAttribute.h"
+
+@interface MASConstraintBuilder () <MASConstraintDelegate>
+
+@property (nonatomic, strong) UIView *view;
+@property (nonatomic, strong) NSMutableArray *constraints;
+
+@end
+
+@implementation MASConstraintBuilder
+
+- (id)initWithView:(UIView *)view {
+    self = [super init];
+    if (!self) return nil;
+    
+    self.view = view;
+    self.constraints = NSMutableArray.new;
+    
+    return self;
+}
+
+- (void)commit {
+    for (id<MASConstraint> constraint in self.constraints) {
+        [constraint commit];
+    }
+    [self.constraints removeAllObjects];
+}
+
+#pragma mark - MASConstraintDelegate
+
+- (void)addConstraint:(id<MASConstraint>)constraint {
+    [self.constraints addObject:constraint];
+}
+
+#pragma mark - constraint properties
+
+- (id<MASConstraint>)constraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
+    MASViewAttribute *viewAttribute = [[MASViewAttribute alloc] initWithView:self.view layoutAttribute:layoutAttribute];
+    MASViewConstraint *constraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:viewAttribute];
+    constraint.delegate = self;
+    return constraint;
+}
+
+#pragma mark - standard Attributes
+
+- (id<MASConstraint>)left {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeLeft];
+}
+
+- (id<MASConstraint>)top {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeTop];
+}
+
+- (id<MASConstraint>)right {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeRight];
+}
+
+- (id<MASConstraint>)bottom {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeBottom];
+}
+
+- (id<MASConstraint>)leading {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeLeading];
+}
+
+- (id<MASConstraint>)trailing {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeTrailing];
+}
+
+- (id<MASConstraint>)width {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeWidth];
+}
+
+- (id<MASConstraint>)height {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeHeight];
+}
+
+- (id<MASConstraint>)centerX {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeCenterX];
+}
+
+- (id<MASConstraint>)centerY {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeCenterY];
+}
+
+- (id<MASConstraint>)baseline {
+    return [self constraintWithLayoutAttribute:NSLayoutAttributeBaseline];
+}
+
+
+#pragma mark - composite Attributes
+
+- (id<MASConstraint>)sides {
+    MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithView:self.view type:MASCompositeViewConstraintTypeSides];
+    constraint.delegate = self;
+    return constraint;
+}
+
+- (id<MASConstraint>)size {
+    MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithView:self.view type:MASCompositeViewConstraintTypeSize];
+    constraint.delegate = self;
+    return constraint;
+}
+
+- (id<MASConstraint>)center {
+    MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithView:self.view type:MASCompositeViewConstraintTypeCenter];
+    constraint.delegate = self;
+    return constraint;
+}
+@end

+ 20 - 0
Masonry/MASViewAttribute.h

@@ -0,0 +1,20 @@
+//
+//  MASAttribute.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASViewAttribute : NSObject
+
+@property (nonatomic, strong, readonly) UIView *view;
+@property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute;
+
+- (id)initWithView:(UIView *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute;
+
+- (BOOL)isAlignment;
+
+@end

+ 27 - 0
Masonry/MASViewAttribute.m

@@ -0,0 +1,27 @@
+//
+//  MASAttribute.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASViewAttribute.h"
+
+@implementation MASViewAttribute
+
+- (id)initWithView:(UIView *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute {
+    self = [super init];
+    if (!self) return nil;
+    
+    _view = view;
+    _layoutAttribute = layoutAttribute;
+    
+    return self;
+}
+
+- (BOOL)isAlignment {
+    return self.layoutAttribute != NSLayoutAttributeWidth && self.layoutAttribute != NSLayoutAttributeHeight;
+}
+
+@end

+ 20 - 0
Masonry/MASViewConstraint.h

@@ -0,0 +1,20 @@
+//
+//  MASConstraint.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASViewAttribute.h"
+#import "MASConstraint.h"
+
+@interface MASViewConstraint : NSObject <MASConstraint>
+
+@property (nonatomic, weak) id<MASConstraintDelegate> delegate;
+@property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute;
+@property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute;
+
+- (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute;
+
+@end

+ 259 - 0
Masonry/MASViewConstraint.m

@@ -0,0 +1,259 @@
+//
+//  MASConstraint.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASViewConstraint.h"
+
+@interface MASViewConstraint ()
+
+@property (nonatomic, strong, readwrite) MASViewAttribute *secondViewAttribute;
+@property (nonatomic, strong) NSLayoutConstraint *layoutConstraint;
+@property (nonatomic, assign) NSLayoutRelation layoutRelation;
+@property (nonatomic, assign) UILayoutPriority layoutPriority;
+@property (nonatomic, assign) CGFloat layoutMultiplier;
+@property (nonatomic, assign) CGFloat layoutConstant;
+@property (nonatomic, assign) BOOL hasLayoutRelation;
+
+@end
+
+@implementation MASViewConstraint
+
+- (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute {
+    self = [super init];
+    if (!self) return nil;
+    
+    _firstViewAttribute = firstViewAttribute;
+    self.layoutPriority = UILayoutPriorityRequired;
+    self.layoutMultiplier = 1;
+    
+    return self;
+}
+
+#pragma mark - private
+
+- (void)setLayoutConstant:(CGFloat)layoutConstant {
+    _layoutConstant = layoutConstant;
+    self.layoutConstraint.constant = layoutConstant;
+}
+
+- (void)setLayoutRelation:(NSLayoutRelation)layoutRelation {
+    _layoutRelation = layoutRelation;
+    self.hasLayoutRelation = YES;
+}
+
+- (BOOL)hasBeenCommitted {
+    return self.layoutConstraint != nil;
+}
+
+- (instancetype)cloneIfNeeded {
+    if (self.hasLayoutRelation) {
+        MASViewAttribute *firstViewAttribute = [[MASViewAttribute alloc] initWithView:self.firstViewAttribute.view layoutAttribute:self.firstViewAttribute.layoutAttribute];
+        
+        MASViewConstraint *viewConstraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:firstViewAttribute];
+        viewConstraint.delegate = self.delegate;
+        viewConstraint.layoutRelation = self.layoutRelation;
+        return viewConstraint;
+    }
+    return self;
+}
+
+#pragma mark - layout constant
+
+- (id<MASConstraint> (^)(UIEdgeInsets))insets {
+    return ^id(UIEdgeInsets insets){
+        NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
+        switch (layoutAttribute) {
+            case NSLayoutAttributeLeft:
+                self.layoutConstant = insets.left;
+                break;
+            case NSLayoutAttributeTop:
+                self.layoutConstant = insets.top;
+                break;
+            case NSLayoutAttributeBottom:
+                self.layoutConstant = -insets.bottom;
+                break;
+            case NSLayoutAttributeRight:
+                self.layoutConstant = -insets.right;
+                break;
+            default:
+                break;
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(CGSize))sizeOffset {
+    return ^id(CGSize offset) {
+        NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
+        switch (layoutAttribute) {
+            case NSLayoutAttributeWidth:
+                self.layoutConstant = offset.width;
+                break;
+            case NSLayoutAttributeHeight:
+                self.layoutConstant = offset.height;
+                break;
+            default:
+                break;
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(CGPoint))centerOffset {
+    return ^id(CGPoint offset) {
+        NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
+        switch (layoutAttribute) {
+            case NSLayoutAttributeCenterX:
+                self.layoutConstant = offset.x;
+                break;
+            case NSLayoutAttributeCenterY:
+                self.layoutConstant = offset.y;
+                break;
+            default:
+                break;
+        }
+        return self;
+    };
+}
+
+- (id<MASConstraint> (^)(CGFloat))offset {
+    return ^id(CGFloat offset){
+        self.layoutConstant = offset;
+        return self;
+    };
+}
+
+#pragma mark - layout multiplier
+
+- (id<MASConstraint> (^)(CGFloat))percent {
+    return ^id(CGFloat percent) {
+        NSAssert(!self.hasBeenCommitted,
+                 @"Cannot modify constraint percent after it has been committed");
+        
+        self.layoutMultiplier = percent;
+        return self;
+    };
+}
+
+#pragma mark - layout priority
+
+- (id<MASConstraint> (^)(UILayoutPriority))priority {
+    return ^id(UILayoutPriority priority) {
+        NSAssert(!self.hasBeenCommitted,
+                 @"Cannot modify constraint priority after it has been committed");
+        
+        self.layoutPriority = priority;
+        return self;
+    };
+}
+
+#pragma mark - layout relation
+
+- (void)setSecondViewAttribute:(id)secondViewAttribute {
+    if ([secondViewAttribute isKindOfClass:NSNumber.class]) {
+        self.layoutConstant = [secondViewAttribute doubleValue];
+    } else if ([secondViewAttribute isKindOfClass:NSArray.class]) {
+        //TODO Composite
+    } else if ([secondViewAttribute isKindOfClass:UIView.class]) {
+        _secondViewAttribute = [[MASViewAttribute alloc] initWithView:secondViewAttribute layoutAttribute:self.firstViewAttribute.layoutAttribute];
+    } else if ([secondViewAttribute isKindOfClass:MASViewAttribute.class]) {
+        _secondViewAttribute = secondViewAttribute;
+    } else {
+        NSAssert(YES, @"attempting to add unsupported attribute: %@", secondViewAttribute);
+    }
+    [self.delegate addConstraint:self];
+}
+
+- (id<MASConstraint> (^)(id))equal {
+    return ^id(id attr) {
+        NSAssert(!self.hasBeenCommitted,
+                 @"Cannot modify constraint equal relation after it has been committed");
+        
+        MASViewConstraint *viewConstraint = [self cloneIfNeeded];
+        viewConstraint.layoutRelation = NSLayoutRelationEqual;
+        viewConstraint.secondViewAttribute = attr;
+        return viewConstraint;
+    };
+}
+
+- (id<MASConstraint> (^)(id))greaterThanOrEqual {
+    return ^id(id attr) {
+        NSAssert(!self.hasBeenCommitted,
+                 @"Cannot modify constraint greaterThanOrEqual relation after it has been committed");
+        
+        MASViewConstraint *viewConstraint = [self cloneIfNeeded];
+        viewConstraint.layoutRelation = NSLayoutRelationGreaterThanOrEqual;
+        viewConstraint.secondViewAttribute = attr;
+        return viewConstraint;
+    };
+}
+
+- (id<MASConstraint> (^)(id))lessThanOrEqual {
+    return ^id(id attr) {
+        NSAssert(!self.hasBeenCommitted,
+                 @"Cannot modify constraint lessThanOrEqual relation after it has been committed");
+        
+        MASViewConstraint *viewConstraint = [self cloneIfNeeded];
+        viewConstraint.layoutRelation = NSLayoutRelationLessThanOrEqual;
+        viewConstraint.secondViewAttribute = attr;
+        return viewConstraint;
+    };
+}
+
+#pragma mark - MASConstraint
+
+- (void)commit {
+    NSAssert(!self.hasBeenCommitted, @"Cannot commit constraint more than once");
+    
+    UIView *firstLayoutItem = self.firstViewAttribute.view;
+    NSLayoutAttribute firstLayoutAttribute = self.firstViewAttribute.layoutAttribute;
+    UIView *secondLayoutItem = self.secondViewAttribute.view;
+    NSLayoutAttribute secondLayoutAttribute = self.secondViewAttribute.layoutAttribute;
+    if (self.firstViewAttribute.isAlignment && !self.secondViewAttribute) {
+        secondLayoutItem = firstLayoutItem.superview;
+        secondLayoutAttribute = firstLayoutAttribute;
+    }
+    
+    
+    self.layoutConstraint = [NSLayoutConstraint constraintWithItem:firstLayoutItem
+                                                         attribute:firstLayoutAttribute
+                                                         relatedBy:self.layoutRelation
+                                                            toItem:secondLayoutItem
+                                                         attribute:secondLayoutAttribute
+                                                        multiplier:self.layoutMultiplier
+                                                          constant:self.layoutConstant];
+    
+    self.layoutConstraint.priority = self.layoutPriority;
+    
+    if (secondLayoutItem) {
+        UIView *closestCommonSuperview = nil;
+        
+        UIView *secondViewSuperview = secondLayoutItem;
+        while (!closestCommonSuperview && secondViewSuperview) {
+            UIView *firstViewSuperview = firstLayoutItem;
+            while (!closestCommonSuperview && firstViewSuperview) {
+                if (secondViewSuperview == firstViewSuperview) {
+                    closestCommonSuperview = secondViewSuperview;
+                }
+                firstViewSuperview = firstViewSuperview.superview;
+            }
+            secondViewSuperview = secondViewSuperview.superview;
+        }
+        NSAssert(closestCommonSuperview,
+                 @"couldn't find a common superview for %@ and %@",
+                 firstLayoutItem,
+                 secondLayoutItem);
+        [closestCommonSuperview addConstraint:self.layoutConstraint];
+    } else {
+        
+        [firstLayoutItem addConstraint:self.layoutConstraint];
+    }
+    
+    
+}
+
+@end

+ 14 - 0
Masonry/Masonry-Prefix.pch

@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'Masonry' target in the 'Masonry' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_6_0
+#warning "This project uses features only available in iOS SDK 6.0 and later."
+#endif
+
+#ifdef __OBJC__
+    #import <UIKit/UIKit.h>
+    #import <Foundation/Foundation.h>
+#endif

+ 11 - 0
Masonry/Masonry.h

@@ -0,0 +1,11 @@
+//
+//  Masonry.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "UIView+MASAdditions.h"
+#import "MASViewConstraint.h"
+#import "MASConstraintBuilder.h"

+ 52 - 0
Masonry/UIView+MASAdditions.h

@@ -0,0 +1,52 @@
+//
+//  UIView+MASAdditions.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MASConstraintBuilder.h"
+#import "MASViewAttribute.h"
+
+
+@interface UIView (MASAdditions)
+
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_left;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_top;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_right;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_leading;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_width;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_height;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY;
+@property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline;
+
+- (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
+
+@end
+
+#ifdef MAS_SHORTHAND
+
+@interface UIView (MASShortHandAdditions)
+
+@property (nonatomic, strong, readonly) MASViewAttribute *left;
+@property (nonatomic, strong, readonly) MASViewAttribute *top;
+@property (nonatomic, strong, readonly) MASViewAttribute *right;
+@property (nonatomic, strong, readonly) MASViewAttribute *bottom;
+@property (nonatomic, strong, readonly) MASViewAttribute *leading;
+@property (nonatomic, strong, readonly) MASViewAttribute *trailing;
+@property (nonatomic, strong, readonly) MASViewAttribute *width;
+@property (nonatomic, strong, readonly) MASViewAttribute *height;
+@property (nonatomic, strong, readonly) MASViewAttribute *centerX;
+@property (nonatomic, strong, readonly) MASViewAttribute *centerY;
+@property (nonatomic, strong, readonly) MASViewAttribute *baseline;
+
+- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
+
+@end
+
+#endif

+ 91 - 0
Masonry/UIView+MASAdditions.m

@@ -0,0 +1,91 @@
+//
+//  UIView+MASAdditions.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "UIView+MASAdditions.h"
+
+@implementation UIView (MASAdditions)
+
+- (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constraints))block {
+    self.translatesAutoresizingMaskIntoConstraints = NO;
+    MASConstraintBuilder *viewConstraintBuilder = [[MASConstraintBuilder alloc] initWithView:self];
+    block(viewConstraintBuilder);
+    [viewConstraintBuilder commit];
+}
+
+#pragma mark - attribute properties
+
+- (MASViewAttribute *)mas_left {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeft];
+}
+
+- (MASViewAttribute *)mas_top {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTop];
+}
+
+- (MASViewAttribute *)mas_right {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRight];
+}
+
+- (MASViewAttribute *)mas_bottom {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottom];
+}
+
+- (MASViewAttribute *)mas_leading {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeading];
+}
+
+- (MASViewAttribute *)mas_trailing {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailing];
+}
+
+- (MASViewAttribute *)mas_width {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeWidth];
+}
+
+- (MASViewAttribute *)mas_height {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeHeight];
+}
+
+- (MASViewAttribute *)mas_centerX {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterX];
+}
+
+- (MASViewAttribute *)mas_centerY {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterY];
+}
+
+- (MASViewAttribute *)mas_baseline {
+    return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline];
+}
+
+@end
+
+#define MAS_ATTR_FORWARD(attr)  \
+- (MASViewAttribute *)attr {    \
+    return [self mas_##attr];   \
+}
+
+@implementation UIView (MASShortHandAdditions)
+
+MAS_ATTR_FORWARD(top);
+MAS_ATTR_FORWARD(left);
+MAS_ATTR_FORWARD(bottom);
+MAS_ATTR_FORWARD(right);
+MAS_ATTR_FORWARD(leading);
+MAS_ATTR_FORWARD(trailing);
+MAS_ATTR_FORWARD(width);
+MAS_ATTR_FORWARD(height);
+MAS_ATTR_FORWARD(centerX);
+MAS_ATTR_FORWARD(centerY);
+MAS_ATTR_FORWARD(baseline);
+
+- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block {
+    [self mas_buildConstraints:block];
+}
+
+@end

+ 347 - 0
MasonryExamples/MasonryExamples.xcodeproj/project.pbxproj

@@ -0,0 +1,347 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		DD52F22B179CAD57005CD195 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F22A179CAD57005CD195 /* UIKit.framework */; };
+		DD52F22D179CAD57005CD195 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F22C179CAD57005CD195 /* Foundation.framework */; };
+		DD52F22F179CAD57005CD195 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F22E179CAD57005CD195 /* CoreGraphics.framework */; };
+		DD52F235179CAD57005CD195 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = DD52F233179CAD57005CD195 /* InfoPlist.strings */; };
+		DD52F237179CAD57005CD195 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F236179CAD57005CD195 /* main.m */; };
+		DD52F23B179CAD57005CD195 /* MASAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F23A179CAD57005CD195 /* MASAppDelegate.m */; };
+		DD52F251179CADC0005CD195 /* MASExampleBasicView.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F248179CADC0005CD195 /* MASExampleBasicView.m */; };
+		DD52F252179CADC0005CD195 /* MASExampleConstantsView.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F24A179CADC0005CD195 /* MASExampleConstantsView.m */; };
+		DD52F253179CADC0005CD195 /* MASExampleListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F24C179CADC0005CD195 /* MASExampleListViewController.m */; };
+		DD52F254179CADC0005CD195 /* MASExampleSidesView.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F24E179CADC0005CD195 /* MASExampleSidesView.m */; };
+		DD52F255179CADC0005CD195 /* MASExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD52F250179CADC0005CD195 /* MASExampleViewController.m */; };
+		DD52F26E179CBA05005CD195 /* libMasonry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F26D179CBA05005CD195 /* libMasonry.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		DD52F227179CAD57005CD195 /* MasonryExamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MasonryExamples.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		DD52F22A179CAD57005CD195 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+		DD52F22C179CAD57005CD195 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+		DD52F22E179CAD57005CD195 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+		DD52F232179CAD57005CD195 /* MasonryExamples-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MasonryExamples-Info.plist"; sourceTree = "<group>"; };
+		DD52F234179CAD57005CD195 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		DD52F236179CAD57005CD195 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+		DD52F238179CAD57005CD195 /* MasonryExamples-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MasonryExamples-Prefix.pch"; sourceTree = "<group>"; };
+		DD52F239179CAD57005CD195 /* MASAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASAppDelegate.h; sourceTree = "<group>"; };
+		DD52F23A179CAD57005CD195 /* MASAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASAppDelegate.m; sourceTree = "<group>"; };
+		DD52F247179CADC0005CD195 /* MASExampleBasicView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleBasicView.h; sourceTree = "<group>"; };
+		DD52F248179CADC0005CD195 /* MASExampleBasicView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleBasicView.m; sourceTree = "<group>"; };
+		DD52F249179CADC0005CD195 /* MASExampleConstantsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleConstantsView.h; sourceTree = "<group>"; };
+		DD52F24A179CADC0005CD195 /* MASExampleConstantsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleConstantsView.m; sourceTree = "<group>"; };
+		DD52F24B179CADC0005CD195 /* MASExampleListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleListViewController.h; sourceTree = "<group>"; };
+		DD52F24C179CADC0005CD195 /* MASExampleListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleListViewController.m; sourceTree = "<group>"; };
+		DD52F24D179CADC0005CD195 /* MASExampleSidesView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleSidesView.h; sourceTree = "<group>"; };
+		DD52F24E179CADC0005CD195 /* MASExampleSidesView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleSidesView.m; sourceTree = "<group>"; };
+		DD52F24F179CADC0005CD195 /* MASExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleViewController.h; sourceTree = "<group>"; };
+		DD52F250179CADC0005CD195 /* MASExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleViewController.m; sourceTree = "<group>"; };
+		DD52F26D179CBA05005CD195 /* libMasonry.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libMasonry.a; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		DD52F224179CAD57005CD195 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F26E179CBA05005CD195 /* libMasonry.a in Frameworks */,
+				DD52F22B179CAD57005CD195 /* UIKit.framework in Frameworks */,
+				DD52F22D179CAD57005CD195 /* Foundation.framework in Frameworks */,
+				DD52F22F179CAD57005CD195 /* CoreGraphics.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		DD52F21E179CAD57005CD195 = {
+			isa = PBXGroup;
+			children = (
+				DD52F26D179CBA05005CD195 /* libMasonry.a */,
+				DD52F230179CAD57005CD195 /* MasonryExamples */,
+				DD52F229179CAD57005CD195 /* Frameworks */,
+				DD52F228179CAD57005CD195 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		DD52F228179CAD57005CD195 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F227179CAD57005CD195 /* MasonryExamples.app */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		DD52F229179CAD57005CD195 /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F22A179CAD57005CD195 /* UIKit.framework */,
+				DD52F22C179CAD57005CD195 /* Foundation.framework */,
+				DD52F22E179CAD57005CD195 /* CoreGraphics.framework */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+		DD52F230179CAD57005CD195 /* MasonryExamples */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F239179CAD57005CD195 /* MASAppDelegate.h */,
+				DD52F23A179CAD57005CD195 /* MASAppDelegate.m */,
+				DD52F257179CADCB005CD195 /* Controllers */,
+				DD52F256179CADC4005CD195 /* Views */,
+				DD52F231179CAD57005CD195 /* Supporting Files */,
+			);
+			path = MasonryExamples;
+			sourceTree = "<group>";
+		};
+		DD52F231179CAD57005CD195 /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F232179CAD57005CD195 /* MasonryExamples-Info.plist */,
+				DD52F233179CAD57005CD195 /* InfoPlist.strings */,
+				DD52F236179CAD57005CD195 /* main.m */,
+				DD52F238179CAD57005CD195 /* MasonryExamples-Prefix.pch */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+		DD52F256179CADC4005CD195 /* Views */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F247179CADC0005CD195 /* MASExampleBasicView.h */,
+				DD52F248179CADC0005CD195 /* MASExampleBasicView.m */,
+				DD52F249179CADC0005CD195 /* MASExampleConstantsView.h */,
+				DD52F24A179CADC0005CD195 /* MASExampleConstantsView.m */,
+				DD52F24D179CADC0005CD195 /* MASExampleSidesView.h */,
+				DD52F24E179CADC0005CD195 /* MASExampleSidesView.m */,
+			);
+			name = Views;
+			sourceTree = "<group>";
+		};
+		DD52F257179CADCB005CD195 /* Controllers */ = {
+			isa = PBXGroup;
+			children = (
+				DD52F24B179CADC0005CD195 /* MASExampleListViewController.h */,
+				DD52F24C179CADC0005CD195 /* MASExampleListViewController.m */,
+				DD52F24F179CADC0005CD195 /* MASExampleViewController.h */,
+				DD52F250179CADC0005CD195 /* MASExampleViewController.m */,
+			);
+			name = Controllers;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		DD52F226179CAD57005CD195 /* MasonryExamples */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = DD52F244179CAD57005CD195 /* Build configuration list for PBXNativeTarget "MasonryExamples" */;
+			buildPhases = (
+				DD52F223179CAD57005CD195 /* Sources */,
+				DD52F224179CAD57005CD195 /* Frameworks */,
+				DD52F225179CAD57005CD195 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = MasonryExamples;
+			productName = MasonryExamples;
+			productReference = DD52F227179CAD57005CD195 /* MasonryExamples.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		DD52F21F179CAD57005CD195 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				CLASSPREFIX = MAS;
+				LastUpgradeCheck = 0460;
+				ORGANIZATIONNAME = "Jonas Budelmann";
+			};
+			buildConfigurationList = DD52F222179CAD57005CD195 /* Build configuration list for PBXProject "MasonryExamples" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = DD52F21E179CAD57005CD195;
+			productRefGroup = DD52F228179CAD57005CD195 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				DD52F226179CAD57005CD195 /* MasonryExamples */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		DD52F225179CAD57005CD195 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F235179CAD57005CD195 /* InfoPlist.strings in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		DD52F223179CAD57005CD195 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD52F237179CAD57005CD195 /* main.m in Sources */,
+				DD52F23B179CAD57005CD195 /* MASAppDelegate.m in Sources */,
+				DD52F251179CADC0005CD195 /* MASExampleBasicView.m in Sources */,
+				DD52F252179CADC0005CD195 /* MASExampleConstantsView.m in Sources */,
+				DD52F253179CADC0005CD195 /* MASExampleListViewController.m in Sources */,
+				DD52F254179CADC0005CD195 /* MASExampleSidesView.m in Sources */,
+				DD52F255179CADC0005CD195 /* MASExampleViewController.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		DD52F233179CAD57005CD195 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				DD52F234179CAD57005CD195 /* en */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		DD52F242179CAD57005CD195 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = YES;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				COPY_PHASE_STRIP = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		DD52F243179CAD57005CD195 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = YES;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				COPY_PHASE_STRIP = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+		DD52F245179CAD57005CD195 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "MasonryExamples/MasonryExamples-Prefix.pch";
+				INFOPLIST_FILE = "MasonryExamples/MasonryExamples-Info.plist";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/Masonry-fbkxraflfpslgmcoluezbqgkgcsz/Build/Products/Debug-iphoneos\"",
+				);
+				OTHER_LDFLAGS = (
+					"-ObjC",
+					"-all_load",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				USER_HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/**";
+				WRAPPER_EXTENSION = app;
+			};
+			name = Debug;
+		};
+		DD52F246179CAD57005CD195 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = "MasonryExamples/MasonryExamples-Prefix.pch";
+				INFOPLIST_FILE = "MasonryExamples/MasonryExamples-Info.plist";
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/Masonry-fbkxraflfpslgmcoluezbqgkgcsz/Build/Products/Debug-iphoneos\"",
+				);
+				OTHER_LDFLAGS = (
+					"-ObjC",
+					"-all_load",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				USER_HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/**";
+				WRAPPER_EXTENSION = app;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		DD52F222179CAD57005CD195 /* Build configuration list for PBXProject "MasonryExamples" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DD52F242179CAD57005CD195 /* Debug */,
+				DD52F243179CAD57005CD195 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		DD52F244179CAD57005CD195 /* Build configuration list for PBXNativeTarget "MasonryExamples" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DD52F245179CAD57005CD195 /* Debug */,
+				DD52F246179CAD57005CD195 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = DD52F21F179CAD57005CD195 /* Project object */;
+}

+ 100 - 0
MasonryExamples/MasonryExamples.xcodeproj/xcshareddata/xcschemes/MasonryExamples.xcscheme

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0460"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "DD52F1A9179CA93B005CD195"
+               BuildableName = "libMasonry.a"
+               BlueprintName = "Masonry"
+               ReferencedContainer = "container:../Masonry.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "DD52F226179CAD57005CD195"
+               BuildableName = "MasonryExamples.app"
+               BlueprintName = "MasonryExamples"
+               ReferencedContainer = "container:MasonryExamples.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "DD52F226179CAD57005CD195"
+            BuildableName = "MasonryExamples.app"
+            BlueprintName = "MasonryExamples"
+            ReferencedContainer = "container:MasonryExamples.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "DD52F226179CAD57005CD195"
+            BuildableName = "MasonryExamples.app"
+            BlueprintName = "MasonryExamples"
+            ReferencedContainer = "container:MasonryExamples.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "DD52F226179CAD57005CD195"
+            BuildableName = "MasonryExamples.app"
+            BlueprintName = "MasonryExamples"
+            ReferencedContainer = "container:MasonryExamples.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 15 - 0
MasonryExamples/MasonryExamples/MASAppDelegate.h

@@ -0,0 +1,15 @@
+//
+//  MASAppDelegate.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@end

+ 25 - 0
MasonryExamples/MasonryExamples/MASAppDelegate.m

@@ -0,0 +1,25 @@
+//
+//  MASAppDelegate.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASAppDelegate.h"
+#import "MASExampleListViewController.h"
+
+@implementation MASAppDelegate
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
+    // Override point for customization after application launch.
+    self.window.backgroundColor = UIColor.whiteColor;
+    
+    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:MASExampleListViewController.new];
+    self.window.rootViewController = navigationController;
+    [self.window makeKeyAndVisible];
+    return YES;
+}
+
+@end

+ 13 - 0
MasonryExamples/MasonryExamples/MASExampleBasicView.h

@@ -0,0 +1,13 @@
+//
+//  MASExampleBasicView.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASExampleBasicView : UIView
+
+@end

+ 78 - 0
MasonryExamples/MasonryExamples/MASExampleBasicView.m

@@ -0,0 +1,78 @@
+//
+//  MASExampleBasicView.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASExampleBasicView.h"
+
+@implementation MASExampleBasicView
+
+- (id)init {
+    self = [super init];
+    if (!self) return nil;
+    
+    UIView *view1 = UIView.new;
+    view1.backgroundColor = UIColor.greenColor;
+    view1.layer.borderColor = UIColor.blackColor.CGColor;
+    view1.layer.borderWidth = 2;
+    [self addSubview:view1];
+    
+    UIView *view2 = UIView.new;
+    view2.backgroundColor = UIColor.redColor;
+    view2.layer.borderColor = UIColor.blackColor.CGColor;
+    view2.layer.borderWidth = 2;
+    [self addSubview:view2];
+    
+    UIView *view3 = UIView.new;
+    view3.backgroundColor = UIColor.blueColor;
+    view3.layer.borderColor = UIColor.blackColor.CGColor;
+    view3.layer.borderWidth = 2;
+    [self addSubview:view3];
+    
+    UIView *superview = self;
+    int padding = 10;
+    
+    [view1 mas_buildConstraints:^(MASConstraintBuilder *constraints) {
+        constraints.top.equal(superview.mas_top).offset(padding);
+        constraints.left.equal(superview.mas_left).offset(padding);
+        constraints.bottom.equal(view3.mas_top).offset(-padding);
+        constraints.right.equal(view2.mas_left).offset(-padding);
+        constraints.width.equal(view2.mas_width);
+        
+        //you can chain same attribute
+        constraints.height
+            .equal(view2.mas_height)
+            .equal(view3.mas_height);
+    }];
+    
+    [view2 mas_buildConstraints:^(MASConstraintBuilder *constraints) {
+        constraints.top.equal(superview.mas_top).offset(padding);
+        constraints.left.equal(view1.mas_right).offset(padding);
+        constraints.bottom.equal(view3.mas_top).offset(-padding);
+        constraints.right.equal(superview.mas_right).offset(-padding);
+        constraints.width.equal(view1.mas_width);
+        
+        //or define it multiple times
+        constraints.height.equal(view1.mas_height);
+        constraints.height.equal(view3.mas_height);
+    }];
+    
+    [view3 mas_buildConstraints:^(MASConstraintBuilder *constraints) {
+        constraints.top.equal(view1.mas_bottom).offset(padding);
+        constraints.left.equal(superview.mas_left).offset(padding);
+        constraints.bottom.equal(superview.mas_bottom).offset(-padding);
+        constraints.right.equal(superview.mas_right).offset(-padding);
+        
+        //TODO or pass an array
+        //constraints.height.equal(superview.subviews);
+        constraints.height.equal(view1.mas_height);
+        constraints.height.equal(view2.mas_height);
+    }];
+    
+    return self;
+}
+
+@end

+ 13 - 0
MasonryExamples/MasonryExamples/MASExampleConstantsView.h

@@ -0,0 +1,13 @@
+//
+//  MASExampleConstantsView.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASExampleConstantsView : UIView
+
+@end

+ 48 - 0
MasonryExamples/MasonryExamples/MASExampleConstantsView.m

@@ -0,0 +1,48 @@
+//
+//  MASExampleConstantsView.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASExampleConstantsView.h"
+
+@implementation MASExampleConstantsView
+
+- (id)init {
+    self = [super init];
+    if (!self) return nil;
+    
+    UIView *view1 = UIView.new;
+    view1.backgroundColor = UIColor.purpleColor;
+    view1.layer.borderColor = UIColor.blackColor.CGColor;
+    view1.layer.borderWidth = 2;
+    [self addSubview:view1];
+    
+    UIView *view2 = UIView.new;
+    view2.backgroundColor = UIColor.orangeColor;
+    view2.layer.borderColor = UIColor.blackColor.CGColor;
+    view2.layer.borderWidth = 2;
+    [self addSubview:view2];
+    
+    //example of using constants
+    
+    [view1 mas_buildConstraints:^(MASConstraintBuilder *constraints) {
+        constraints.top.equal(@20);
+        constraints.left.equal(@20);
+        constraints.bottom.equal(@-20);
+        constraints.right.equal(@-20);
+    }];
+    
+    [view2 mas_buildConstraints:^(MASConstraintBuilder *constraints) {
+        constraints.centerY.equal(@50);
+        constraints.centerX.equal(@0);
+        constraints.width.equal(@200);
+        constraints.height.equal(@100);
+    }];
+    
+    return self;
+}
+
+@end

+ 13 - 0
MasonryExamples/MasonryExamples/MASExampleListViewController.h

@@ -0,0 +1,13 @@
+//
+//  MASExampleListViewController.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASExampleListViewController : UITableViewController
+
+@end

+ 66 - 0
MasonryExamples/MasonryExamples/MASExampleListViewController.m

@@ -0,0 +1,66 @@
+//
+//  MASExampleListViewController.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASExampleListViewController.h"
+#import "MASExampleViewController.h"
+#import "MASExampleBasicView.h"
+#import "MASExampleConstantsView.h"
+#import "MASExampleSidesView.h"
+
+static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier";
+
+@interface MASExampleListViewController ()
+
+@property (nonatomic, strong) NSArray *exampleControllers;
+
+@end
+
+@implementation MASExampleListViewController
+
+- (id)init {
+    self = [super init];
+    if (!self) return nil;
+    
+    self.title = @"Examples";
+    
+    self.exampleControllers = @[
+        [[MASExampleViewController alloc] initWithTitle:@"Basic" viewClass:MASExampleBasicView.class],
+        [[MASExampleViewController alloc] initWithTitle:@"Using Constants" viewClass:MASExampleConstantsView.class],
+        [[MASExampleViewController alloc] initWithTitle:@"Composite sides" viewClass:MASExampleSidesView.class],
+    ];
+    
+    return self;
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    [self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:kMASCellReuseIdentifier];
+}
+
+#pragma mark - UITableViewDataSource
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    UIViewController *viewController = self.exampleControllers[indexPath.row];
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kMASCellReuseIdentifier forIndexPath:indexPath];
+    cell.textLabel.text = viewController.title;
+    return cell;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.exampleControllers.count;
+}
+
+#pragma mark - UITableViewDelegate
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    UIViewController *viewController = self.exampleControllers[indexPath.row];
+    [self.navigationController pushViewController:viewController animated:YES];
+}
+
+@end

+ 13 - 0
MasonryExamples/MasonryExamples/MASExampleSidesView.h

@@ -0,0 +1,13 @@
+//
+//  MASExampleSidesView.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASExampleSidesView : UIView
+
+@end

+ 42 - 0
MasonryExamples/MasonryExamples/MASExampleSidesView.m

@@ -0,0 +1,42 @@
+//
+//  MASExampleSidesView.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASExampleSidesView.h"
+
+@implementation MASExampleSidesView
+
+- (id)init {
+    self = [super init];
+    if (!self) return nil;
+    
+    UIView *lastView = self;
+    for (int i = 0; i < 10; i++) {
+        UIView *view = UIView.new;
+        view.backgroundColor = [self randomColor];
+        view.layer.borderColor = UIColor.blackColor.CGColor;
+        view.layer.borderWidth = 2;
+        [self addSubview:view];
+        
+        [view mas_buildConstraints:^(MASConstraintBuilder *constraints) {
+            constraints.sides.equal(lastView).insets(UIEdgeInsetsMake(5, 10, 15, 20));
+        }];
+        
+        lastView = view;
+    }
+    
+    return self;
+}
+
+- (UIColor *)randomColor {
+    CGFloat hue = ( arc4random() % 256 / 256.0 );  //  0.0 to 1.0
+    CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5;  //  0.5 to 1.0, away from white
+    CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5;  //  0.5 to 1.0, away from black
+    return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
+}
+
+@end

+ 15 - 0
MasonryExamples/MasonryExamples/MASExampleViewController.h

@@ -0,0 +1,15 @@
+//
+//  MASExampleOneViewController.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MASExampleViewController : UIViewController
+
+- (id)initWithTitle:(NSString *)title viewClass:(Class)viewClass;
+
+@end

+ 34 - 0
MasonryExamples/MasonryExamples/MASExampleViewController.m

@@ -0,0 +1,34 @@
+//
+//  MASExampleOneViewController.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 20/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASExampleViewController.h"
+#import "MASExampleBasicView.h"
+
+@interface MASExampleViewController ()
+
+@property (nonatomic, strong) Class viewClass;
+
+@end
+
+@implementation MASExampleViewController
+
+- (id)initWithTitle:(NSString *)title viewClass:(Class)viewClass {
+    self = [super init];
+    if (!self) return nil;
+    
+    self.title = title;
+    self.viewClass = viewClass;
+    
+    return self;
+}
+
+- (void)loadView {
+    self.view = self.viewClass.new;
+}
+
+@end

+ 45 - 0
MasonryExamples/MasonryExamples/MasonryExamples-Info.plist

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleDisplayName</key>
+	<string>${PRODUCT_NAME}</string>
+	<key>CFBundleExecutable</key>
+	<string>${EXECUTABLE_NAME}</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.cloudling.${PRODUCT_NAME:rfc1034identifier}</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>${PRODUCT_NAME}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1.0</string>
+	<key>LSRequiresIPhoneOS</key>
+	<true/>
+	<key>UIRequiredDeviceCapabilities</key>
+	<array>
+		<string>armv7</string>
+	</array>
+	<key>UISupportedInterfaceOrientations</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+		<string>UIInterfaceOrientationLandscapeLeft</string>
+		<string>UIInterfaceOrientationLandscapeRight</string>
+	</array>
+	<key>UISupportedInterfaceOrientations~ipad</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+		<string>UIInterfaceOrientationPortraitUpsideDown</string>
+		<string>UIInterfaceOrientationLandscapeLeft</string>
+		<string>UIInterfaceOrientationLandscapeRight</string>
+	</array>
+</dict>
+</plist>

+ 18 - 0
MasonryExamples/MasonryExamples/MasonryExamples-Prefix.pch

@@ -0,0 +1,18 @@
+//
+// Prefix header for all source files of the 'MasonryExamples' target in the 'MasonryExamples' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iOS SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+    #import <UIKit/UIKit.h>
+    #import <Foundation/Foundation.h>
+    #import <QuartzCore/QuartzCore.h>
+
+    #define MAS_SHORTHAND
+    #import "Masonry.h"
+#endif

+ 2 - 0
MasonryExamples/MasonryExamples/en.lproj/InfoPlist.strings

@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+

+ 18 - 0
MasonryExamples/MasonryExamples/main.m

@@ -0,0 +1,18 @@
+//
+//  main.m
+//  MasonryExamples
+//
+//  Created by Jonas Budelmann on 22/07/13.
+//  Copyright (c) 2013 Jonas Budelmann. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "MASAppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+    @autoreleasepool {
+        return UIApplicationMain(argc, argv, nil, NSStringFromClass([MASAppDelegate class]));
+    }
+}

+ 59 - 0
MasonryTests/MASCompositeConstraintSpec.m

@@ -0,0 +1,59 @@
+//
+//  MASCompositeConstraintSpec.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 22/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASCompositeConstraint.h"
+
+SpecBegin(MASCompositeConstraint)
+
+__block MASCompositeConstraint *composite;
+__block id<MASConstraintDelegate> delegate;
+
+beforeEach(^{
+    delegate = mockProtocol(@protocol(MASConstraintDelegate));
+});
+
+describe(@"commit", ^{
+
+    
+    
+});
+
+describe(@"centering", ^{
+    
+    beforeEach(^{
+        composite = [[MASCompositeConstraint alloc] initWithView:mock(UIView.class) type:MASCompositeViewConstraintTypeCenter];
+        composite.delegate = delegate;
+    });
+    
+    xit(@"should forward to children", ^{});
+    
+});
+
+describe(@"sizing", ^{
+    
+    beforeEach(^{
+        composite = [[MASCompositeConstraint alloc] initWithView:mock(UIView.class) type:MASCompositeViewConstraintTypeCenter];
+        composite.delegate = delegate;
+    });
+    
+    xit(@"should forward to children", ^{});
+    
+});
+
+describe(@"alignment", ^{
+    
+    beforeEach(^{
+        composite = [[MASCompositeConstraint alloc] initWithView:mock(UIView.class) type:MASCompositeViewConstraintTypeCenter];
+        composite.delegate = delegate;
+    });
+    
+    xit(@"should forward to children", ^{});
+    
+});
+
+SpecEnd

+ 178 - 0
MasonryTests/MASViewConstraintSpec.m

@@ -0,0 +1,178 @@
+//
+//  MASViewConstraintSpec.m
+//  Masonry
+//
+//  Created by Jonas Budelmann on 21/07/13.
+//  Copyright (c) 2013 cloudling. All rights reserved.
+//
+
+#import "MASViewConstraint.h"
+#import "MASConstraint.h"
+
+@interface MASViewConstraint ()
+
+@property (nonatomic, strong) NSLayoutConstraint *layoutConstraint;
+@property (nonatomic, assign) NSLayoutRelation layoutRelation;
+@property (nonatomic, assign) UILayoutPriority layoutPriority;
+@property (nonatomic, assign) CGFloat layoutMultiplier;
+@property (nonatomic, assign) CGFloat layoutConstant;
+@property (nonatomic, assign) BOOL hasLayoutRelation;
+
+@end
+
+SpecBegin(MASViewConstraint)
+
+__block UIView *superview;
+__block MASViewConstraint *constraint;
+__block id<MASConstraintDelegate> delegate;
+__block MASViewAttribute *secondViewAttribute;
+
+beforeEach(^{
+    superview = mock(UIView.class);
+    
+    UIView *secondView = mock(UIView.class);
+    [given(secondView.superview) willReturn:superview];
+    secondViewAttribute = [[MASViewAttribute alloc] initWithView:secondView layoutAttribute:NSLayoutAttributeHeight];
+    delegate = mockProtocol(@protocol(MASConstraintDelegate));
+    
+    UIView *firstView = mock(UIView.class);
+    [given(firstView.superview) willReturn:superview];
+    MASViewAttribute *firstViewAttribute = [[MASViewAttribute alloc] initWithView:firstView layoutAttribute:NSLayoutAttributeWidth];
+    constraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:firstViewAttribute];
+    constraint.delegate = delegate;
+});
+
+describe(@"equality chaining", ^{
+    
+    it(@"should return same constraint when encountering equal for first time", ^{
+        MASViewConstraint *newConstraint = constraint.equal(secondViewAttribute);
+        
+        [verify(delegate) addConstraint:(id)constraint];
+        expect(newConstraint).to.beIdenticalTo(constraint);
+        expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute);
+        expect(constraint.layoutRelation).to.ex_equal(NSLayoutRelationEqual);
+    });
+    
+    it(@"should start new constraint when encountering equal subsequently", ^{
+        constraint.greaterThanOrEqual(secondViewAttribute);
+        MASViewConstraint *newConstraint = constraint.equal(secondViewAttribute);
+        
+        [verify(delegate) addConstraint:(id)constraint];
+        [verify(delegate) addConstraint:(id)newConstraint];
+        expect(newConstraint).notTo.beIdenticalTo(constraint);
+    });
+    
+    it(@"should return same constraint when encountering greaterThanOrEqual for first time", ^{
+        MASViewConstraint *newConstraint = constraint.greaterThanOrEqual(secondViewAttribute);
+        
+        [verify(delegate) addConstraint:(id)constraint];
+        expect(newConstraint).to.beIdenticalTo(constraint);
+        expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute);
+        expect(constraint.layoutRelation).to.ex_equal(NSLayoutRelationGreaterThanOrEqual);
+    });
+    
+    it(@"should start new constraint when encountering greaterThanOrEqual subsequently", ^{
+        constraint.lessThanOrEqual(secondViewAttribute);
+        MASViewConstraint *newConstraint = constraint.greaterThanOrEqual(secondViewAttribute);
+        
+        [verify(delegate) addConstraint:(id)constraint];
+        [verify(delegate) addConstraint:(id)newConstraint];
+        expect(newConstraint).notTo.beIdenticalTo(constraint);
+    });
+    
+    it(@"should return same constraint when encountering lessThanOrEqual for first time", ^{
+        MASViewConstraint *newConstraint = constraint.lessThanOrEqual(secondViewAttribute);
+        
+        [verify(delegate) addConstraint:(id)constraint];
+        expect(newConstraint).to.beIdenticalTo(constraint);
+        expect(constraint.secondViewAttribute).to.beIdenticalTo(secondViewAttribute);
+        expect(constraint.layoutRelation).to.ex_equal(NSLayoutRelationLessThanOrEqual);
+    });
+    
+    it(@"should start new constraint when encountering lessThanOrEqual subsequently", ^{
+        constraint.equal(secondViewAttribute);
+        MASViewConstraint *newConstraint = constraint.lessThanOrEqual(secondViewAttribute);
+        
+        [verify(delegate) addConstraint:(id)constraint];
+        [verify(delegate) addConstraint:(id)newConstraint];
+        expect(newConstraint).notTo.beIdenticalTo(constraint);
+    });
+    
+    it(@"should not allow update of equal once layoutconstraint is created", ^{
+        [constraint commit];
+        
+        expect(^{
+            constraint.equal(secondViewAttribute);
+        }).to.raise(@"NSInternalInconsistencyException");
+    });
+    
+    it(@"should not allow update of lessThanOrEqual once layoutconstraint is created", ^{
+        [constraint commit];
+        
+        expect(^{
+            constraint.lessThanOrEqual(secondViewAttribute);
+        }).to.raise(@"NSInternalInconsistencyException");
+    });
+    
+    it(@"should not allow update of greaterThanOrEqual once layoutconstraint is created", ^{
+        [constraint commit];
+        
+        expect(^{
+            constraint.greaterThanOrEqual(secondViewAttribute);
+        }).to.raise(@"NSInternalInconsistencyException");
+    });
+
+    xit(@"should create composite when passed array of views", ^{
+
+    });
+});
+
+describe(@"multiplier & constant", ^{
+
+    it(@"should not allow update of multiplier after layoutconstraint is created", ^{
+        [constraint commit];
+        
+        expect(^{
+            constraint.percent(0.9);
+        }).to.raise(@"NSInternalInconsistencyException");
+    });
+    
+    it(@"should allow update of constant after layoutconstraint is created", ^{
+        [constraint commit];
+        constraint.offset(10);
+        
+        expect(constraint.layoutConstant).to.ex_equal(10);
+        expect(constraint.layoutConstraint.constant).to.ex_equal(10);
+    });
+    
+    xit(@"should update sides only", ^{});
+    
+    xit(@"should update center only", ^{});
+    
+    xit(@"should update size only", ^{});
+});
+
+describe(@"commit", ^{
+    
+    it(@"should create layout constraint", ^{
+        constraint.equal(secondViewAttribute);
+        constraint.percent(0.5);
+        constraint.offset(10);
+        constraint.priority(345);
+        [constraint commit];
+        
+        expect(constraint.layoutConstraint.firstAttribute).to.ex_equal(NSLayoutAttributeWidth);
+        expect(constraint.layoutConstraint.secondAttribute).to.ex_equal(NSLayoutAttributeHeight);
+        expect(constraint.layoutConstraint.firstItem).to.beIdenticalTo(constraint.firstViewAttribute.view);
+        expect(constraint.layoutConstraint.secondItem).to.beIdenticalTo(constraint.secondViewAttribute.view);
+        expect(constraint.layoutConstraint.relation).to.ex_equal(NSLayoutRelationEqual);
+        expect(constraint.layoutConstraint.constant).to.ex_equal(10);
+        expect(constraint.layoutConstraint.priority).to.ex_equal(345);
+        expect(constraint.layoutConstraint.multiplier).to.ex_equal(0.5);
+        
+        [verify(superview) addConstraint:constraint.layoutConstraint];
+    });
+    
+});
+
+SpecEnd

+ 22 - 0
MasonryTests/MasonryTests-Info.plist

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleExecutable</key>
+	<string>${EXECUTABLE_NAME}</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.cloudling.${PRODUCT_NAME:rfc1034identifier}</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>

+ 20 - 0
MasonryTests/MasonryTests-Prefix.pch

@@ -0,0 +1,20 @@
+//
+// Prefix header for all source files of the 'MasonryTests' target in the 'Masonry' project
+//
+
+#ifdef __OBJC__
+    #import <Foundation/Foundation.h>
+
+    #import "Specta.h"
+
+    #define EXP_SHORTHAND
+    #import "Expecta.h"
+    #undef equal
+    #define ex_equal(expected) _equal(EXPObjectify((expected)))
+
+    #define HC_SHORTHAND
+    #import <OCHamcrest/OCHamcrest.h>
+
+    #define MOCKITO_SHORTHAND
+    #import <OCMockito/OCMockito.h>
+#endif

+ 2 - 0
MasonryTests/en.lproj/InfoPlist.strings

@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+

+ 7 - 0
Podfile

@@ -0,0 +1,7 @@
+platform :ios, '6.0'
+
+target 'MasonryTests', :exclusive => true do
+    pod 'Specta'
+	pod 'Expecta'
+	pod 'OCMockito'
+end