Jonas Budelmann 11 лет назад
Родитель
Сommit
83e5edf516

+ 0 - 423
ExpressiveLayout.xcodeproj/project.pbxproj

@@ -1,423 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 46;
-	objects = {
-
-/* Begin PBXBuildFile section */
-		DDCE87541940224E0015932A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE87531940224E0015932A /* AppDelegate.swift */; };
-		DDCE87561940224E0015932A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDCE87551940224E0015932A /* Images.xcassets */; };
-		DDCE87621940224E0015932A /* ExpressiveLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE87611940224E0015932A /* ExpressiveLayoutTests.swift */; };
-		DDCE876C194022820015932A /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE876B194022820015932A /* RootViewController.swift */; };
-		DDCE876F194025400015932A /* SingleConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE876E194025400015932A /* SingleConstraint.swift */; };
-		DDCE8771194025C40015932A /* CompositeConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE8770194025C40015932A /* CompositeConstraint.swift */; };
-		DDCE8773194026370015932A /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE8772194026370015932A /* Operators.swift */; };
-		DDCE87751940290A0015932A /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDCE87741940290A0015932A /* Constraint.swift */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
-		DDCE875C1940224E0015932A /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = DDCE87461940224E0015932A /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = DDCE874D1940224E0015932A;
-			remoteInfo = ExpressiveLayout;
-		};
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
-		DDCE874E1940224E0015932A /* ExpressiveLayout.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExpressiveLayout.app; sourceTree = BUILT_PRODUCTS_DIR; };
-		DDCE87521940224E0015932A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		DDCE87531940224E0015932A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
-		DDCE87551940224E0015932A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
-		DDCE875B1940224E0015932A /* ExpressiveLayoutTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExpressiveLayoutTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
-		DDCE87601940224E0015932A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		DDCE87611940224E0015932A /* ExpressiveLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpressiveLayoutTests.swift; sourceTree = "<group>"; };
-		DDCE876B194022820015932A /* RootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = "<group>"; };
-		DDCE876E194025400015932A /* SingleConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleConstraint.swift; sourceTree = "<group>"; };
-		DDCE8770194025C40015932A /* CompositeConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompositeConstraint.swift; sourceTree = "<group>"; };
-		DDCE8772194026370015932A /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
-		DDCE87741940290A0015932A /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-		DDCE874B1940224E0015932A /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		DDCE87581940224E0015932A /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-		DDCE87451940224E0015932A = {
-			isa = PBXGroup;
-			children = (
-				DDCE876D1940228D0015932A /* ExpressiveLayout */,
-				DDCE87501940224E0015932A /* Examples */,
-				DDCE875E1940224E0015932A /* ExpressiveLayoutTests */,
-				DDCE874F1940224E0015932A /* Products */,
-			);
-			sourceTree = "<group>";
-		};
-		DDCE874F1940224E0015932A /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				DDCE874E1940224E0015932A /* ExpressiveLayout.app */,
-				DDCE875B1940224E0015932A /* ExpressiveLayoutTests.xctest */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
-		DDCE87501940224E0015932A /* Examples */ = {
-			isa = PBXGroup;
-			children = (
-				DDCE87531940224E0015932A /* AppDelegate.swift */,
-				DDCE876B194022820015932A /* RootViewController.swift */,
-				DDCE87551940224E0015932A /* Images.xcassets */,
-				DDCE87511940224E0015932A /* Supporting Files */,
-			);
-			name = Examples;
-			path = ExpressiveLayout;
-			sourceTree = "<group>";
-		};
-		DDCE87511940224E0015932A /* Supporting Files */ = {
-			isa = PBXGroup;
-			children = (
-				DDCE87521940224E0015932A /* Info.plist */,
-			);
-			name = "Supporting Files";
-			sourceTree = "<group>";
-		};
-		DDCE875E1940224E0015932A /* ExpressiveLayoutTests */ = {
-			isa = PBXGroup;
-			children = (
-				DDCE87611940224E0015932A /* ExpressiveLayoutTests.swift */,
-				DDCE875F1940224E0015932A /* Supporting Files */,
-			);
-			path = ExpressiveLayoutTests;
-			sourceTree = "<group>";
-		};
-		DDCE875F1940224E0015932A /* Supporting Files */ = {
-			isa = PBXGroup;
-			children = (
-				DDCE87601940224E0015932A /* Info.plist */,
-			);
-			name = "Supporting Files";
-			sourceTree = "<group>";
-		};
-		DDCE876D1940228D0015932A /* ExpressiveLayout */ = {
-			isa = PBXGroup;
-			children = (
-				DDCE87741940290A0015932A /* Constraint.swift */,
-				DDCE876E194025400015932A /* SingleConstraint.swift */,
-				DDCE8770194025C40015932A /* CompositeConstraint.swift */,
-				DDCE8772194026370015932A /* Operators.swift */,
-			);
-			path = ExpressiveLayout;
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
-		DDCE874D1940224E0015932A /* ExpressiveLayout */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = DDCE87651940224E0015932A /* Build configuration list for PBXNativeTarget "ExpressiveLayout" */;
-			buildPhases = (
-				DDCE874A1940224E0015932A /* Sources */,
-				DDCE874B1940224E0015932A /* Frameworks */,
-				DDCE874C1940224E0015932A /* Resources */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = ExpressiveLayout;
-			productName = ExpressiveLayout;
-			productReference = DDCE874E1940224E0015932A /* ExpressiveLayout.app */;
-			productType = "com.apple.product-type.application";
-		};
-		DDCE875A1940224E0015932A /* ExpressiveLayoutTests */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = DDCE87681940224E0015932A /* Build configuration list for PBXNativeTarget "ExpressiveLayoutTests" */;
-			buildPhases = (
-				DDCE87571940224E0015932A /* Sources */,
-				DDCE87581940224E0015932A /* Frameworks */,
-				DDCE87591940224E0015932A /* Resources */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-				DDCE875D1940224E0015932A /* PBXTargetDependency */,
-			);
-			name = ExpressiveLayoutTests;
-			productName = ExpressiveLayoutTests;
-			productReference = DDCE875B1940224E0015932A /* ExpressiveLayoutTests.xctest */;
-			productType = "com.apple.product-type.bundle.unit-test";
-		};
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-		DDCE87461940224E0015932A /* Project object */ = {
-			isa = PBXProject;
-			attributes = {
-				LastUpgradeCheck = 0600;
-				ORGANIZATIONNAME = "Jonas Budelmann";
-				TargetAttributes = {
-					DDCE874D1940224E0015932A = {
-						CreatedOnToolsVersion = 6.0;
-					};
-					DDCE875A1940224E0015932A = {
-						CreatedOnToolsVersion = 6.0;
-						TestTargetID = DDCE874D1940224E0015932A;
-					};
-				};
-			};
-			buildConfigurationList = DDCE87491940224E0015932A /* Build configuration list for PBXProject "ExpressiveLayout" */;
-			compatibilityVersion = "Xcode 3.2";
-			developmentRegion = English;
-			hasScannedForEncodings = 0;
-			knownRegions = (
-				en,
-			);
-			mainGroup = DDCE87451940224E0015932A;
-			productRefGroup = DDCE874F1940224E0015932A /* Products */;
-			projectDirPath = "";
-			projectRoot = "";
-			targets = (
-				DDCE874D1940224E0015932A /* ExpressiveLayout */,
-				DDCE875A1940224E0015932A /* ExpressiveLayoutTests */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
-		DDCE874C1940224E0015932A /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				DDCE87561940224E0015932A /* Images.xcassets in Resources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		DDCE87591940224E0015932A /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
-		DDCE874A1940224E0015932A /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				DDCE87751940290A0015932A /* Constraint.swift in Sources */,
-				DDCE8771194025C40015932A /* CompositeConstraint.swift in Sources */,
-				DDCE8773194026370015932A /* Operators.swift in Sources */,
-				DDCE876F194025400015932A /* SingleConstraint.swift in Sources */,
-				DDCE876C194022820015932A /* RootViewController.swift in Sources */,
-				DDCE87541940224E0015932A /* AppDelegate.swift in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		DDCE87571940224E0015932A /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				DDCE87621940224E0015932A /* ExpressiveLayoutTests.swift in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
-		DDCE875D1940224E0015932A /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = DDCE874D1940224E0015932A /* ExpressiveLayout */;
-			targetProxy = DDCE875C1940224E0015932A /* PBXContainerItemProxy */;
-		};
-/* End PBXTargetDependency section */
-
-/* Begin XCBuildConfiguration section */
-		DDCE87631940224E0015932A /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
-				CLANG_CXX_LIBRARY = "libc++";
-				CLANG_ENABLE_MODULES = YES;
-				CLANG_ENABLE_OBJC_ARC = YES;
-				CLANG_WARN_BOOL_CONVERSION = YES;
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
-				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-				CLANG_WARN_EMPTY_BODY = YES;
-				CLANG_WARN_ENUM_CONVERSION = YES;
-				CLANG_WARN_INT_CONVERSION = YES;
-				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-				CLANG_WARN_UNREACHABLE_CODE = YES;
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				COPY_PHASE_STRIP = NO;
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
-				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_64_TO_32_BIT_CONVERSION = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
-				METAL_ENABLE_DEBUG_INFO = YES;
-				ONLY_ACTIVE_ARCH = YES;
-				SDKROOT = iphoneos;
-				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
-				TARGETED_DEVICE_FAMILY = "1,2";
-			};
-			name = Debug;
-		};
-		DDCE87641940224E0015932A /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ALWAYS_SEARCH_USER_PATHS = NO;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
-				CLANG_CXX_LIBRARY = "libc++";
-				CLANG_ENABLE_MODULES = YES;
-				CLANG_ENABLE_OBJC_ARC = YES;
-				CLANG_WARN_BOOL_CONVERSION = YES;
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
-				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-				CLANG_WARN_EMPTY_BODY = YES;
-				CLANG_WARN_ENUM_CONVERSION = YES;
-				CLANG_WARN_INT_CONVERSION = YES;
-				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-				CLANG_WARN_UNREACHABLE_CODE = YES;
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				COPY_PHASE_STRIP = YES;
-				ENABLE_NS_ASSERTIONS = NO;
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
-				GCC_C_LANGUAGE_STANDARD = gnu99;
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
-				METAL_ENABLE_DEBUG_INFO = NO;
-				SDKROOT = iphoneos;
-				TARGETED_DEVICE_FAMILY = "1,2";
-				VALIDATE_PRODUCT = YES;
-			};
-			name = Release;
-		};
-		DDCE87661940224E0015932A /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
-				INFOPLIST_FILE = ExpressiveLayout/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				PRODUCT_NAME = "$(TARGET_NAME)";
-			};
-			name = Debug;
-		};
-		DDCE87671940224E0015932A /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
-				INFOPLIST_FILE = ExpressiveLayout/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				PRODUCT_NAME = "$(TARGET_NAME)";
-			};
-			name = Release;
-		};
-		DDCE87691940224E0015932A /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ExpressiveLayout.app/ExpressiveLayout";
-				FRAMEWORK_SEARCH_PATHS = (
-					"$(SDKROOT)/Developer/Library/Frameworks",
-					"$(inherited)",
-				);
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"DEBUG=1",
-					"$(inherited)",
-				);
-				INFOPLIST_FILE = ExpressiveLayoutTests/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
-				METAL_ENABLE_DEBUG_INFO = YES;
-				PRODUCT_NAME = "$(TARGET_NAME)";
-				TEST_HOST = "$(BUNDLE_LOADER)";
-			};
-			name = Debug;
-		};
-		DDCE876A1940224E0015932A /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ExpressiveLayout.app/ExpressiveLayout";
-				FRAMEWORK_SEARCH_PATHS = (
-					"$(SDKROOT)/Developer/Library/Frameworks",
-					"$(inherited)",
-				);
-				INFOPLIST_FILE = ExpressiveLayoutTests/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
-				METAL_ENABLE_DEBUG_INFO = NO;
-				PRODUCT_NAME = "$(TARGET_NAME)";
-				TEST_HOST = "$(BUNDLE_LOADER)";
-			};
-			name = Release;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		DDCE87491940224E0015932A /* Build configuration list for PBXProject "ExpressiveLayout" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				DDCE87631940224E0015932A /* Debug */,
-				DDCE87641940224E0015932A /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
-		DDCE87651940224E0015932A /* Build configuration list for PBXNativeTarget "ExpressiveLayout" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				DDCE87661940224E0015932A /* Debug */,
-				DDCE87671940224E0015932A /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-		};
-		DDCE87681940224E0015932A /* Build configuration list for PBXNativeTarget "ExpressiveLayoutTests" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				DDCE87691940224E0015932A /* Debug */,
-				DDCE876A1940224E0015932A /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = DDCE87461940224E0015932A /* Project object */;
-}

+ 0 - 7
ExpressiveLayout.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Workspace
-   version = "1.0">
-   <FileRef
-      location = "self:ExpressiveLayout.xcodeproj">
-   </FileRef>
-</Workspace>

+ 0 - 10
ExpressiveLayout/CompositeConstraint.swift

@@ -1,10 +0,0 @@
-//
-//  CompositeConstraint.swift
-//  ExpressiveLayout
-//
-//  Created by Jonas Budelmann on 5/06/14.
-//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
-//
-
-import Foundation
-

+ 0 - 14
ExpressiveLayout/Constraint.swift

@@ -1,14 +0,0 @@
-//
-//  Constraint.swift
-//  ExpressiveLayout
-//
-//  Created by Jonas Budelmann on 5/06/14.
-//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
-//
-
-import Foundation
-
-protocol Constraint {
-    func add(other: Any) -> Constraint
-    func equalTo(other: Any) -> Constraint
-}

+ 0 - 52
ExpressiveLayout/Operators.swift

@@ -1,52 +0,0 @@
-//
-//  Operators.swift
-//  ExpressiveLayout
-//
-//  Created by Jonas Budelmann on 5/06/14.
-//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
-//
-
-import UIKit
-
-//TODO spilt into different files
-
-enum ViewLayoutAttribute {
-    case CenterX
-    case CenterY
-    case Left
-    case Right
-    case Top
-    case Bottom
-    case Width
-    case Height
-}
-
-class ViewAttribute {
-    weak var view: UIView?
-    let attribute: ViewLayoutAttribute
-    
-    init(view: UIView, attribute: ViewLayoutAttribute) {
-        self.view = view
-        self.attribute = attribute
-    }
-}
-
-@infix func + (left: Constraint, right: Any) -> Constraint {
-    return left.add(right);
-}
-
-@infix func == (left: Constraint, right: Any) -> Constraint {
-    return left.equalTo(right);
-}
-
-func installConstraints(constraints: Array<Constraint>) {
-    // find common superview
-    // create NSLayoutConstraint
-}
-
-extension UIView {
-    var left: Constraint { return SingleConstraint(view: self, attribute: .Left) }
-    var right: Constraint { return SingleConstraint(view: self, attribute: .Right) }
-    var top: Constraint { return SingleConstraint(view: self, attribute: .Top) }
-    var bottom: Constraint { return SingleConstraint(view: self, attribute: .Bottom) }
-}

+ 0 - 74
ExpressiveLayout/RootViewController.swift

@@ -1,74 +0,0 @@
-//
-//  RootViewController.swift
-//  ExpressiveLayout
-//
-//  Created by Jonas Budelmann on 5/06/14.
-//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
-//
-
-import UIKit
-
-class RootViewController : UIViewController {
-    
-    override func viewDidLoad() {
-        self.view.backgroundColor = UIColor.whiteColor()
-        
-        let superview = self.view
-        
-        let view1 = UIView()
-        view1.backgroundColor = UIColor.greenColor()
-        view1.layer.borderColor = UIColor.blackColor().CGColor
-        view1.layer.borderWidth = 2
-        superview.addSubview(view1)
-        
-        let view2 = UIView()
-        view2.backgroundColor = UIColor.redColor()
-        view2.layer.borderColor = UIColor.blackColor().CGColor
-        view2.layer.borderWidth = 2
-        superview.addSubview(view2)
-        
-        let view3 = UIView()
-        view3.backgroundColor = UIColor.blueColor()
-        view3.layer.borderColor = UIColor.blackColor().CGColor
-        view3.layer.borderWidth = 2
-        superview.addSubview(view3)
-        
-        var padding = 10;
-        
-        installConstraints([
-            view1.left == superview.left + padding
-        ])
-        
-//        //if you want to use Masonry without the mas_ prefix
-//        //define MAS_SHORTHAND before importing Masonry.h see Masonry iOS Examples-Prefix.pch
-//        [view1 makeConstraints:^(MASConstraintMaker *make) {
-//        make.top.greaterThanOrEqualTo(superview.top).offset(padding);
-//        make.left.equalTo(superview.left).offset(padding);
-//        make.bottom.equalTo(view3.top).offset(-padding);
-//        make.right.equalTo(view2.left).offset(-padding);
-//        make.width.equalTo(view2.width);
-//        
-//        make.height.equalTo(view2.height);
-//        make.height.equalTo(view3.height);
-//        }];
-//        
-//        //with is semantic and option
-//        [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
-//        make.top.equalTo(superview.mas_top).with.offset(padding); //with with
-//        make.left.equalTo(view1.mas_right).offset(padding); //without with
-//        make.bottom.equalTo(view3.mas_top).offset(-padding);
-//        make.right.equalTo(superview.mas_right).offset(-padding);
-//        make.width.equalTo(view1.mas_width);
-//        
-//        make.height.equalTo(@[view1, view3]); //can pass array of views
-//        }];
-//        
-//        [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
-//        make.top.equalTo(view1.mas_bottom).offset(padding);
-//        make.left.equalTo(superview.mas_left).offset(padding);
-//        make.bottom.equalTo(superview.mas_bottom).offset(-padding);
-//        make.right.equalTo(superview.mas_right).offset(-padding);
-//        make.height.equalTo(@[view1.mas_height, view2.mas_height]); //can pass array of attributes
-//        }];
-    }
-}

+ 0 - 44
ExpressiveLayout/SingleConstraint.swift

@@ -1,44 +0,0 @@
-//
-//  ViewConstraint.swift
-//  ExpressiveLayout
-//
-//  Created by Jonas Budelmann on 5/06/14.
-//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
-//
-
-import UIKit
-
-class SingleConstraint : Constraint {
-    
-    var firstViewAttribute: ViewAttribute
-    var secondViewAttribute: ViewAttribute?
-    var layoutConstant: Double = 0
-    
-    init(view: UIView, attribute: ViewLayoutAttribute) {
-        firstViewAttribute = ViewAttribute(view: view, attribute: attribute)
-    }
-    
-    func add(other: Any) -> Constraint {
-        switch other {
-        case let offset as Double:
-            layoutConstant += offset;
-        case let constraint as SingleConstraint:
-            println("TODO add to \(constraint)")
-        default:
-            println("unsupported value: \(other)")
-        }
-        return self;
-    }
-    
-    func equalTo(other: Any) -> Constraint {
-        switch other {
-        case let offset as Double:
-            layoutConstant = offset;
-        case let constraint as SingleConstraint:
-            self.secondViewAttribute = constraint.firstViewAttribute;
-        default:
-            println("unsupported value: \(other)")
-        }
-        return self;
-    }
-}

+ 0 - 24
ExpressiveLayoutTests/Info.plist

@@ -1,24 +0,0 @@
-<?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>CFBundleName</key>
-	<string>${PRODUCT_NAME}</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>

+ 437 - 0
Snappy.xcodeproj/project.pbxproj

@@ -0,0 +1,437 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		DD03E3151981B52F00E0DE94 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E30F1981B52F00E0DE94 /* AppDelegate.swift */; };
+		DD03E3171981B52F00E0DE94 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD03E3121981B52F00E0DE94 /* Images.xcassets */; };
+		DD03E3191981B52F00E0DE94 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3141981B52F00E0DE94 /* ViewController.swift */; };
+		DD03E3201981B70D00E0DE94 /* CompositeConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E31F1981B70D00E0DE94 /* CompositeConstraint.swift */; };
+		DD03E3221981B71C00E0DE94 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3211981B71C00E0DE94 /* Constraint.swift */; };
+		DD03E3241981B72A00E0DE94 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */; };
+		DD03E3261981B78D00E0DE94 /* ViewAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3251981B78D00E0DE94 /* ViewAttribute.swift */; };
+		DD03E3281981B79C00E0DE94 /* ViewConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3271981B79C00E0DE94 /* ViewConstraint.swift */; };
+		DD03E32A1981B7BF00E0DE94 /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3291981B7BF00E0DE94 /* View.swift */; };
+		DDC9FDAE1981B4DD009612C7 /* SnappyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		DD03E31B1981B66800E0DE94 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = DDC9FD8D1981B4DD009612C7 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = DDC9FD941981B4DD009612C7;
+			remoteInfo = Snappy;
+		};
+		DD03E31D1981B66800E0DE94 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = DDC9FD8D1981B4DD009612C7 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = DDC9FD941981B4DD009612C7;
+			remoteInfo = Snappy;
+		};
+		DDC9FDA81981B4DD009612C7 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = DDC9FD8D1981B4DD009612C7 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = DDC9FD941981B4DD009612C7;
+			remoteInfo = Snappy;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		DD03E30F1981B52F00E0DE94 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
+		DD03E3121981B52F00E0DE94 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
+		DD03E3131981B52F00E0DE94 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		DD03E3141981B52F00E0DE94 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
+		DD03E31F1981B70D00E0DE94 /* CompositeConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompositeConstraint.swift; sourceTree = "<group>"; };
+		DD03E3211981B71C00E0DE94 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = "<group>"; };
+		DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = "<group>"; };
+		DD03E3251981B78D00E0DE94 /* ViewAttribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewAttribute.swift; sourceTree = "<group>"; };
+		DD03E3271981B79C00E0DE94 /* ViewConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewConstraint.swift; sourceTree = "<group>"; };
+		DD03E3291981B7BF00E0DE94 /* View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; };
+		DDC9FD951981B4DD009612C7 /* Snappy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Snappy.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SnappyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+		DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnappyTests.swift; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		DDC9FD921981B4DD009612C7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		DDC9FDA41981B4DD009612C7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		DD03E30E1981B52F00E0DE94 /* SnappyExample */ = {
+			isa = PBXGroup;
+			children = (
+				DD03E30F1981B52F00E0DE94 /* AppDelegate.swift */,
+				DD03E3121981B52F00E0DE94 /* Images.xcassets */,
+				DD03E3131981B52F00E0DE94 /* Info.plist */,
+				DD03E3141981B52F00E0DE94 /* ViewController.swift */,
+			);
+			path = SnappyExample;
+			sourceTree = "<group>";
+		};
+		DD03E31A1981B62D00E0DE94 /* Snappy */ = {
+			isa = PBXGroup;
+			children = (
+				DD03E31F1981B70D00E0DE94 /* CompositeConstraint.swift */,
+				DD03E3211981B71C00E0DE94 /* Constraint.swift */,
+				DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */,
+				DD03E3251981B78D00E0DE94 /* ViewAttribute.swift */,
+				DD03E3271981B79C00E0DE94 /* ViewConstraint.swift */,
+				DD03E3291981B7BF00E0DE94 /* View.swift */,
+			);
+			path = Snappy;
+			sourceTree = "<group>";
+		};
+		DDC9FD8C1981B4DD009612C7 = {
+			isa = PBXGroup;
+			children = (
+				DD03E31A1981B62D00E0DE94 /* Snappy */,
+				DD03E30E1981B52F00E0DE94 /* SnappyExample */,
+				DDC9FDAA1981B4DD009612C7 /* SnappyTests */,
+				DDC9FD961981B4DD009612C7 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		DDC9FD961981B4DD009612C7 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				DDC9FD951981B4DD009612C7 /* Snappy.app */,
+				DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		DDC9FDAA1981B4DD009612C7 /* SnappyTests */ = {
+			isa = PBXGroup;
+			children = (
+				DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */,
+			);
+			path = SnappyTests;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		DDC9FD941981B4DD009612C7 /* Snappy */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = DDC9FDB11981B4DD009612C7 /* Build configuration list for PBXNativeTarget "Snappy" */;
+			buildPhases = (
+				DDC9FD911981B4DD009612C7 /* Sources */,
+				DDC9FD921981B4DD009612C7 /* Frameworks */,
+				DDC9FD931981B4DD009612C7 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = Snappy;
+			productName = Snappy;
+			productReference = DDC9FD951981B4DD009612C7 /* Snappy.app */;
+			productType = "com.apple.product-type.application";
+		};
+		DDC9FDA61981B4DD009612C7 /* SnappyTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = DDC9FDB41981B4DD009612C7 /* Build configuration list for PBXNativeTarget "SnappyTests" */;
+			buildPhases = (
+				DDC9FDA31981B4DD009612C7 /* Sources */,
+				DDC9FDA41981B4DD009612C7 /* Frameworks */,
+				DDC9FDA51981B4DD009612C7 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				DDC9FDA91981B4DD009612C7 /* PBXTargetDependency */,
+				DD03E31C1981B66800E0DE94 /* PBXTargetDependency */,
+				DD03E31E1981B66800E0DE94 /* PBXTargetDependency */,
+			);
+			name = SnappyTests;
+			productName = SnappyTests;
+			productReference = DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		DDC9FD8D1981B4DD009612C7 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0600;
+				ORGANIZATIONNAME = "Jonas Budelmann";
+				TargetAttributes = {
+					DDC9FD941981B4DD009612C7 = {
+						CreatedOnToolsVersion = 6.0;
+					};
+					DDC9FDA61981B4DD009612C7 = {
+						CreatedOnToolsVersion = 6.0;
+						TestTargetID = DDC9FD941981B4DD009612C7;
+					};
+				};
+			};
+			buildConfigurationList = DDC9FD901981B4DD009612C7 /* Build configuration list for PBXProject "Snappy" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+				Base,
+			);
+			mainGroup = DDC9FD8C1981B4DD009612C7;
+			productRefGroup = DDC9FD961981B4DD009612C7 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				DDC9FD941981B4DD009612C7 /* Snappy */,
+				DDC9FDA61981B4DD009612C7 /* SnappyTests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		DDC9FD931981B4DD009612C7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD03E3171981B52F00E0DE94 /* Images.xcassets in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		DDC9FDA51981B4DD009612C7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		DDC9FD911981B4DD009612C7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DD03E32A1981B7BF00E0DE94 /* View.swift in Sources */,
+				DD03E3221981B71C00E0DE94 /* Constraint.swift in Sources */,
+				DD03E3241981B72A00E0DE94 /* ConstraintMaker.swift in Sources */,
+				DD03E3191981B52F00E0DE94 /* ViewController.swift in Sources */,
+				DD03E3281981B79C00E0DE94 /* ViewConstraint.swift in Sources */,
+				DD03E3201981B70D00E0DE94 /* CompositeConstraint.swift in Sources */,
+				DD03E3151981B52F00E0DE94 /* AppDelegate.swift in Sources */,
+				DD03E3261981B78D00E0DE94 /* ViewAttribute.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		DDC9FDA31981B4DD009612C7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				DDC9FDAE1981B4DD009612C7 /* SnappyTests.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		DD03E31C1981B66800E0DE94 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = DDC9FD941981B4DD009612C7 /* Snappy */;
+			targetProxy = DD03E31B1981B66800E0DE94 /* PBXContainerItemProxy */;
+		};
+		DD03E31E1981B66800E0DE94 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = DDC9FD941981B4DD009612C7 /* Snappy */;
+			targetProxy = DD03E31D1981B66800E0DE94 /* PBXContainerItemProxy */;
+		};
+		DDC9FDA91981B4DD009612C7 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = DDC9FD941981B4DD009612C7 /* Snappy */;
+			targetProxy = DDC9FDA81981B4DD009612C7 /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		DDC9FDAF1981B4DD009612C7 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				COPY_PHASE_STRIP = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				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_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MTL_ENABLE_DEBUG_INFO = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = iphoneos;
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		DDC9FDB01981B4DD009612C7 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				COPY_PHASE_STRIP = YES;
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				SDKROOT = iphoneos;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+		DDC9FDB21981B4DD009612C7 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+				INFOPLIST_FILE = SnappyExample/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		DDC9FDB31981B4DD009612C7 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
+				INFOPLIST_FILE = SnappyExample/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+		DDC9FDB51981B4DD009612C7 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Snappy.app/Snappy";
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(SDKROOT)/Developer/Library/Frameworks",
+					"$(inherited)",
+				);
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TEST_HOST = "$(BUNDLE_LOADER)";
+			};
+			name = Debug;
+		};
+		DDC9FDB61981B4DD009612C7 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Snappy.app/Snappy";
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(SDKROOT)/Developer/Library/Frameworks",
+					"$(inherited)",
+				);
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				TEST_HOST = "$(BUNDLE_LOADER)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		DDC9FD901981B4DD009612C7 /* Build configuration list for PBXProject "Snappy" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DDC9FDAF1981B4DD009612C7 /* Debug */,
+				DDC9FDB01981B4DD009612C7 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		DDC9FDB11981B4DD009612C7 /* Build configuration list for PBXNativeTarget "Snappy" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DDC9FDB21981B4DD009612C7 /* Debug */,
+				DDC9FDB31981B4DD009612C7 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		DDC9FDB41981B4DD009612C7 /* Build configuration list for PBXNativeTarget "SnappyTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				DDC9FDB51981B4DD009612C7 /* Debug */,
+				DDC9FDB61981B4DD009612C7 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = DDC9FD8D1981B4DD009612C7 /* Project object */;
+}

+ 36 - 0
Snappy/CompositeConstraint.swift

@@ -0,0 +1,36 @@
+//
+//  CompositeConstraint.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import UIKit
+
+class CompositeConstraint: Constraint, ConstraintDelegate {
+    var children = [Constraint]()
+    
+    init(children: [Constraint]) {
+        self.children = children
+        super.init()
+        for constraint in children {
+            constraint.delegate = self
+        }
+    }
+    
+    func constraint(constraint: Constraint, shouldBeReplacedWithConstraint replacementConstraint: Constraint) {
+        var index = find(self.children, constraint)
+        if (index) {
+            self.children[index!] = replacementConstraint
+        }
+    }
+    
+    func constraint(constraint: Constraint?, addConstraintWithLayoutAttribute layoutAttribute: NSLayoutAttribute) -> Constraint {
+        var newConstraint = self.delegate!.constraint(self, addConstraintWithLayoutAttribute: layoutAttribute)
+        newConstraint.delegate = self
+        self.children.append(newConstraint)
+        return newConstraint
+    }
+
+}

+ 90 - 0
Snappy/Constraint.swift

@@ -0,0 +1,90 @@
+//
+//  Constraint.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import UIKit
+
+@class_protocol protocol ConstraintDelegate {
+    func constraint(constraint: Constraint, shouldBeReplacedWithConstraint replacementConstraint: Constraint)
+    func constraint(constraint: Constraint?, addConstraintWithLayoutAttribute layoutAttribute: NSLayoutAttribute) -> Constraint
+}
+
+class Constraint: Equatable {
+    weak var delegate: ConstraintDelegate?
+    
+    init() {
+        
+    }
+    
+    var left: Constraint { return Constraint() }
+    var top: Constraint { return Constraint() }
+    var right: Constraint { return Constraint() }
+    var bottom: Constraint { return Constraint() }
+    var leading: Constraint { return Constraint() }
+    var trailing: Constraint { return Constraint() }
+    var width: Constraint { return Constraint() }
+    var height: Constraint { return Constraint() }
+    var centerX: Constraint { return Constraint() }
+    var centerY: Constraint { return Constraint() }
+    var baseline: Constraint { return Constraint() }
+    
+    var and: Constraint { return self }
+    var with: Constraint { return self }
+    
+    func equalTo(attr: Any) -> Constraint {
+        return self
+    }
+    
+    func greaterThanOrEqualTo(attr: Any) -> Constraint {
+        return self
+    }
+    
+    func lessThanOrEqualTo(attr: Any) -> Constraint {
+        return self
+    }
+    
+    func insets(insets: Any) -> Constraint {
+        return self
+    }
+    
+    func offset(offset: Any) -> Constraint {
+        return self
+    }
+    
+    func multipliedBy(multiplier: Float) -> Constraint {
+        return self
+    }
+    
+    func dividedBy(divider: Float) -> Constraint {
+        return self
+    }
+    
+    func priority(priority: UILayoutPriority) -> Constraint {
+        return self
+    }
+    
+    func priorityLow() -> Constraint {
+        return self
+    }
+    
+    func priorityMedium() -> Constraint {
+        return self
+    }
+    
+    func priorityHigh() -> Constraint {
+        return self
+    }
+    
+    func install() {
+        
+    }
+}
+
+
+@infix func ==(lhs: Constraint, rhs: Constraint) -> Bool {
+    return lhs === rhs;
+}

+ 86 - 0
Snappy/ConstraintMaker.swift

@@ -0,0 +1,86 @@
+//
+//  ConstraintMaker.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import UIKit
+
+class ConstraintMaker: ConstraintDelegate {
+    var constraints = [Constraint]()
+    weak var view: View?
+    
+    init(view: View) {
+        self.view = view
+    }
+    
+    var left: Constraint { return addConstraint(.Left) }
+    var top: Constraint { return addConstraint(.Top) }
+    var right: Constraint { return addConstraint(.Right) }
+    var bottom: Constraint { return addConstraint(.Bottom) }
+    var leading: Constraint { return addConstraint(.Leading) }
+    var trailing: Constraint { return addConstraint(.Trailing) }
+    var width: Constraint { return addConstraint(.Width) }
+    var height: Constraint { return addConstraint(.Height) }
+    var centerX: Constraint { return addConstraint(.CenterX) }
+    var centerY: Constraint { return addConstraint(.CenterY) }
+    var baseline: Constraint { return addConstraint(.Baseline) }
+    
+    //TODO
+    var edges: Constraint { return addConstraints(.Top, .Left, .Bottom, .Right) }
+    var size: Constraint { return addConstraints(.Width, .Height) }
+    var center: Constraint { return addConstraints(.CenterX, .CenterY) }
+    
+    func install() {
+        for constraint in constraints {
+            constraint.install()
+        }
+        self.constraints.removeAll(keepCapacity: true)
+    }
+    
+    func addConstraint(layoutAttribute: NSLayoutAttribute) -> Constraint {
+        return constraint(nil, addConstraintWithLayoutAttribute: layoutAttribute)
+    }
+    
+    
+    func addConstraints(layoutAttributes: NSLayoutAttribute...) -> Constraint {
+        var children = layoutAttributes.map({ (attr: NSLayoutAttribute) -> Constraint in
+            var viewAttribute = ViewAttribute(view: self.view, layoutAttribute: attr)
+            return ViewConstraint(view: self.view!, firstViewAttribute: viewAttribute)
+        })
+        
+        var constraint = CompositeConstraint(children: children)
+        constraint.delegate = self
+        self.constraints.append(constraint)
+        
+        return constraint
+    }
+    
+    func constraint(constraint: Constraint, shouldBeReplacedWithConstraint replacementConstraint: Constraint) {
+        var index = find(self.constraints, constraint)
+        if (index) {
+            self.constraints[index!] = replacementConstraint
+        }
+    }
+    
+    func constraint(constraint: Constraint?, addConstraintWithLayoutAttribute layoutAttribute: NSLayoutAttribute) -> Constraint {
+        var viewAttribute = ViewAttribute(view: self.view, layoutAttribute: layoutAttribute)
+        var newConstraint = ViewConstraint(view: self.view!, firstViewAttribute: viewAttribute)
+        
+        if let viewConstraint = constraint as? ViewConstraint  {
+            //replace with composite constraint
+            var children = [viewConstraint, newConstraint]
+            var compositeConstraint = CompositeConstraint(children: children)
+            compositeConstraint.delegate = self
+            self.constraint(viewConstraint, shouldBeReplacedWithConstraint:compositeConstraint);
+            return compositeConstraint
+        }
+        if (!constraint) {
+            newConstraint.delegate = self
+            self.constraints.append(newConstraint)
+        }
+        return newConstraint
+    }
+}

+ 51 - 0
Snappy/View.swift

@@ -0,0 +1,51 @@
+//
+//  View.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import Foundation
+
+import UIKit
+typealias View = UIView
+
+extension View {
+    var mas_left: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Left) }
+    var mas_top: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Top) }
+    var mas_right: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Right) }
+    var mas_bottom: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Bottom) }
+    var mas_leading: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Leading) }
+    var mas_trailing: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Trailing) }
+    var mas_width: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Width) }
+    var mas_height: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Height) }
+    var mas_centerX: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .CenterX) }
+    var mas_centerY: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .CenterY) }
+    var mas_baseline: ViewAttribute { return ViewAttribute(view: self, layoutAttribute: .Baseline) }
+    
+    func mas_makeConstraints(block: (make: ConstraintMaker) -> ()) {
+        self.setTranslatesAutoresizingMaskIntoConstraints(false)
+        let constraintMaker: ConstraintMaker = ConstraintMaker(view: self)
+        block(make: constraintMaker)
+        constraintMaker.install()
+    }
+    
+    func mas_closestCommonSuperview(view: View) -> View {
+        var closestCommonSuperview: View? = nil
+        
+        var secondViewSuperview: View = view
+        while (!closestCommonSuperview && secondViewSuperview != nil) {
+            var firstViewSuperview: View = self
+            while (!closestCommonSuperview && firstViewSuperview != nil) {
+                if (secondViewSuperview == firstViewSuperview) {
+                    closestCommonSuperview = secondViewSuperview
+                }
+                firstViewSuperview = firstViewSuperview.superview
+            }
+            secondViewSuperview = secondViewSuperview.superview
+        }
+        return closestCommonSuperview!
+    }
+}
+

+ 14 - 0
Snappy/ViewAttribute.swift

@@ -0,0 +1,14 @@
+//
+//  ViewAttribute.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import UIKit
+
+struct ViewAttribute {
+    weak var view: View?
+    var layoutAttribute: NSLayoutAttribute
+}

+ 23 - 0
Snappy/ViewConstraint.swift

@@ -0,0 +1,23 @@
+//
+//  ViewConstraint.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import UIKit
+
+class ViewConstraint: Constraint {
+    weak var view: View?
+    var firstViewAttribute: ViewAttribute
+    var layoutPriority: UILayoutPriority
+    var layoutMultiplier = 1.0
+    
+    init(view: View, firstViewAttribute: ViewAttribute)  {
+        self.view = view;
+        self.firstViewAttribute = firstViewAttribute;
+        self.layoutPriority = 750 //UILayoutPriorityRequired gives build error!?
+        super.init()
+    }
+}

+ 5 - 8
ExpressiveLayout/AppDelegate.swift → SnappyExample/AppDelegate.swift

@@ -1,8 +1,8 @@
 //
 //  AppDelegate.swift
-//  ExpressiveLayout
+//  Snappy
 //
-//  Created by Jonas Budelmann on 5/06/14.
+//  Created by Jonas Budelmann on 25/07/14.
 //  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
 //
 
@@ -13,13 +13,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
                             
     var window: UIWindow?
 
-    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
-        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
-        // Override point for customization after application launch.
-        
-        let navigationController = UINavigationController(rootViewController: RootViewController())
-        self.window!.rootViewController = navigationController
+    func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
         
+        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
+        self.window!.rootViewController = ViewController()
         self.window!.backgroundColor = UIColor.whiteColor()
         self.window!.makeKeyAndVisible()
         return true

+ 0 - 0
ExpressiveLayout/Images.xcassets/AppIcon.appiconset/Contents.json → SnappyExample/Images.xcassets/AppIcon.appiconset/Contents.json


+ 0 - 0
ExpressiveLayout/Images.xcassets/LaunchImage.launchimage/Contents.json → SnappyExample/Images.xcassets/LaunchImage.launchimage/Contents.json


+ 13 - 0
ExpressiveLayout/Info.plist → SnappyExample/Info.plist

@@ -26,5 +26,18 @@
 	<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>

+ 71 - 0
SnappyExample/ViewController.swift

@@ -0,0 +1,71 @@
+//
+//  ViewController.swift
+//  Snappy
+//
+//  Created by Jonas Budelmann on 25/07/14.
+//  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
+//
+
+import UIKit
+
+class ViewController: UIViewController {
+                            
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        let superview: UIView = self.view
+        
+        let view1 = UIView()
+        view1.backgroundColor = UIColor.greenColor()
+        view1.layer.borderColor = UIColor.blackColor().CGColor
+        view1.layer.borderWidth = 2
+        superview.addSubview(view1)
+        
+        let view2 = UIView()
+        view2.backgroundColor = UIColor.redColor()
+        view2.layer.borderColor = UIColor.blackColor().CGColor
+        view2.layer.borderWidth = 2
+        superview.addSubview(view2)
+        
+        let view3 = UIView()
+        view3.backgroundColor = UIColor.blueColor()
+        view3.layer.borderColor = UIColor.blackColor().CGColor
+        view3.layer.borderWidth = 2
+        superview.addSubview(view3)
+        
+        let padding = UIEdgeInsets(top: 15, left: 10, bottom: 15, right: 10)
+        
+        view1.mas_makeConstraints({ make in
+            make.top.and.left.greaterThanOrEqualTo(superview).insets(padding);
+            
+            make.bottom.equalTo(view3.mas_top).insets(padding);
+            make.right.equalTo(view2.mas_left).insets(padding);
+            make.width.equalTo(view2.mas_width);
+            
+            make.height.equalTo([view2, view3]);
+        });
+        
+        view2.mas_makeConstraints({ make in
+            // chain attributes
+            make.top.and.right.equalTo(superview).insets(padding);
+            
+            make.left.equalTo(view1.mas_right).insets(padding);
+            make.bottom.equalTo(view3.mas_top).insets(padding);
+            make.width.equalTo(view1.mas_width);
+            
+            make.height.equalTo([view1, view3]);
+        });
+        
+        view3.mas_makeConstraints({ make in
+            make.top.equalTo(view1.mas_bottom).insets(padding);
+            
+            // chain attributes
+            make.left.right.and.bottom.equalTo(superview).insets(padding);
+            
+            make.height.equalTo([view1, view2]);
+        });
+        
+    }
+
+}
+

+ 5 - 4
ExpressiveLayoutTests/ExpressiveLayoutTests.swift → SnappyTests/SnappyTests.swift

@@ -1,14 +1,15 @@
 //
-//  ExpressiveLayoutTests.swift
-//  ExpressiveLayoutTests
+//  SnappyTests.swift
+//  SnappyTests
 //
-//  Created by Jonas Budelmann on 5/06/14.
+//  Created by Jonas Budelmann on 25/07/14.
 //  Copyright (c) 2014 Jonas Budelmann. All rights reserved.
 //
 
+import UIKit
 import XCTest
 
-class ExpressiveLayoutTests: XCTestCase {
+class SnappyTests: XCTestCase {
     
     override func setUp() {
         super.setUp()