From 9685c27a29e86e51a54bba58d4cac07a15517e9b Mon Sep 17 00:00:00 2001 From: Robert Payne Date: Tue, 23 Sep 2014 16:28:00 +1200 Subject: [PATCH] Updates for Xcode 6.0/6.1 Compatibility * Removed sample project as it's too much influx right now and need a better way to integrate frameworks properly * Added Snappy.framework target * Added syntax support for Xcode 6.1 --- Snappy.xcodeproj/project.pbxproj | 303 +++++++++--------- Snappy/Constraint.swift | 249 ++++---------- Snappy/ConstraintAttributes.swift | 114 +++++++ Snappy/ConstraintItem.swift | 42 +++ Snappy/ConstraintMaker.swift | 34 +- Snappy/ConstraintRelation.swift | 48 +++ Snappy/{Insets.swift => EdgeInsets.swift} | 22 +- Snappy/Info.plist | 26 ++ Snappy/LayoutConstraint.swift | 7 +- Snappy/Snappy.h | 30 ++ Snappy/View+Snappy.swift | 56 ++++ Snappy/View.swift | 85 ----- SnappyExample/AppDelegate.swift | 25 -- .../AppIcon.appiconset/Contents.json | 53 --- .../LaunchImage.launchimage/Contents.json | 51 --- SnappyExample/Info.plist | 43 --- SnappyExample/ViewController.swift | 60 ---- SnappyTests/Info.plist | 24 ++ SnappyTests/SnappyTests.swift | 2 +- 19 files changed, 584 insertions(+), 690 deletions(-) create mode 100644 Snappy/ConstraintAttributes.swift create mode 100644 Snappy/ConstraintItem.swift create mode 100644 Snappy/ConstraintRelation.swift rename Snappy/{Insets.swift => EdgeInsets.swift} (68%) create mode 100644 Snappy/Info.plist create mode 100644 Snappy/Snappy.h create mode 100644 Snappy/View+Snappy.swift delete mode 100644 Snappy/View.swift delete mode 100644 SnappyExample/AppDelegate.swift delete mode 100644 SnappyExample/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 SnappyExample/Images.xcassets/LaunchImage.launchimage/Contents.json delete mode 100644 SnappyExample/Info.plist delete mode 100644 SnappyExample/ViewController.swift create mode 100644 SnappyTests/Info.plist diff --git a/Snappy.xcodeproj/project.pbxproj b/Snappy.xcodeproj/project.pbxproj index 6210427..cbb7d23 100644 --- a/Snappy.xcodeproj/project.pbxproj +++ b/Snappy.xcodeproj/project.pbxproj @@ -7,65 +7,42 @@ 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 */; }; - DD03E3221981B71C00E0DE94 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3211981B71C00E0DE94 /* Constraint.swift */; }; - DD03E3241981B72A00E0DE94 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */; }; - DD03E32A1981B7BF00E0DE94 /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3291981B7BF00E0DE94 /* View.swift */; }; - DDC9FDAE1981B4DD009612C7 /* SnappyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */; }; - EE1004CB198879AD006CC759 /* Insets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE1004CA198879AD006CC759 /* Insets.swift */; }; - EEC6EB4E1985370500C27B12 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEC6EB4D1985370500C27B12 /* LayoutConstraint.swift */; }; + EEBCC9F019CC64F80083B827 /* EdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9EF19CC64F70083B827 /* EdgeInsets.swift */; }; + EEBCC9F219CC65050083B827 /* View+Snappy.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F119CC65040083B827 /* View+Snappy.swift */; }; + EEBCC9F419CC65110083B827 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F319CC65110083B827 /* ConstraintAttributes.swift */; }; + EEBCC9F619CC65200083B827 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F519CC65200083B827 /* ConstraintRelation.swift */; }; + EEBCC9F819CC65260083B827 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F719CC65260083B827 /* ConstraintItem.swift */; }; + EEBCC9FC19CC65430083B827 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9FB19CC65430083B827 /* ConstraintMaker.swift */; }; + EEBCC9FE19CC65510083B827 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9FD19CC65510083B827 /* LayoutConstraint.swift */; }; + EEBCCA0019CC66020083B827 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9FF19CC66020083B827 /* Constraint.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 = ""; }; - DD03E3121981B52F00E0DE94 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - DD03E3131981B52F00E0DE94 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DD03E3141981B52F00E0DE94 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - DD03E3211981B71C00E0DE94 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = ""; }; - DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = ""; }; - DD03E3291981B7BF00E0DE94 /* View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = ""; }; - 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 = ""; }; - EE1004CA198879AD006CC759 /* Insets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Insets.swift; sourceTree = ""; }; - EEC6EB4D1985370500C27B12 /* LayoutConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutConstraint.swift; sourceTree = ""; }; + EE91728119CB304E007888CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + EE91728219CB304E007888CF /* Snappy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Snappy.h; sourceTree = ""; }; + EE91728B19CB304E007888CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + EE91728C19CB304E007888CF /* SnappyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnappyTests.swift; sourceTree = ""; }; + EEBCC9D819CC627D0083B827 /* Snappy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Snappy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EEBCC9E219CC627E0083B827 /* SnappyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SnappyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + EEBCC9EF19CC64F70083B827 /* EdgeInsets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EdgeInsets.swift; sourceTree = ""; }; + EEBCC9F119CC65040083B827 /* View+Snappy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "View+Snappy.swift"; sourceTree = ""; }; + EEBCC9F319CC65110083B827 /* ConstraintAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintAttributes.swift; sourceTree = ""; }; + EEBCC9F519CC65200083B827 /* ConstraintRelation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintRelation.swift; sourceTree = ""; }; + EEBCC9F719CC65260083B827 /* ConstraintItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintItem.swift; sourceTree = ""; }; + EEBCC9FB19CC65430083B827 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = ""; }; + EEBCC9FD19CC65510083B827 /* LayoutConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutConstraint.swift; sourceTree = ""; }; + EEBCC9FF19CC66020083B827 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - DDC9FD921981B4DD009612C7 /* Frameworks */ = { + EEBCC9D419CC627D0083B827 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - DDC9FDA41981B4DD009612C7 /* Frameworks */ = { + EEBCC9DF19CC627D0083B827 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -75,35 +52,11 @@ /* 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 = ""; - }; - DD03E31A1981B62D00E0DE94 /* Snappy */ = { - isa = PBXGroup; - children = ( - EE1004CA198879AD006CC759 /* Insets.swift */, - EEC6EB4D1985370500C27B12 /* LayoutConstraint.swift */, - DD03E3211981B71C00E0DE94 /* Constraint.swift */, - DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */, - DD03E3291981B7BF00E0DE94 /* View.swift */, - ); - path = Snappy; - sourceTree = ""; - }; DDC9FD8C1981B4DD009612C7 = { isa = PBXGroup; children = ( - DD03E31A1981B62D00E0DE94 /* Snappy */, - DD03E30E1981B52F00E0DE94 /* SnappyExample */, - DDC9FDAA1981B4DD009612C7 /* SnappyTests */, + EE91727F19CB304E007888CF /* Snappy */, + EE91728919CB304E007888CF /* SnappyTests */, DDC9FD961981B4DD009612C7 /* Products */, ); sourceTree = ""; @@ -111,30 +64,75 @@ DDC9FD961981B4DD009612C7 /* Products */ = { isa = PBXGroup; children = ( - DDC9FD951981B4DD009612C7 /* Snappy.app */, - DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */, + EEBCC9D819CC627D0083B827 /* Snappy.framework */, + EEBCC9E219CC627E0083B827 /* SnappyTests.xctest */, ); name = Products; sourceTree = ""; }; - DDC9FDAA1981B4DD009612C7 /* SnappyTests */ = { + EE91727F19CB304E007888CF /* Snappy */ = { isa = PBXGroup; children = ( - DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */, + EE91728219CB304E007888CF /* Snappy.h */, + EEBCC9F119CC65040083B827 /* View+Snappy.swift */, + EEBCC9FB19CC65430083B827 /* ConstraintMaker.swift */, + EEBCC9FF19CC66020083B827 /* Constraint.swift */, + EEBCC9F719CC65260083B827 /* ConstraintItem.swift */, + EEBCC9F319CC65110083B827 /* ConstraintAttributes.swift */, + EEBCC9F519CC65200083B827 /* ConstraintRelation.swift */, + EEBCC9FD19CC65510083B827 /* LayoutConstraint.swift */, + EEBCC9EF19CC64F70083B827 /* EdgeInsets.swift */, + EE91728019CB304E007888CF /* Supporting Files */, + ); + path = Snappy; + sourceTree = ""; + }; + EE91728019CB304E007888CF /* Supporting Files */ = { + isa = PBXGroup; + children = ( + EE91728119CB304E007888CF /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + EE91728919CB304E007888CF /* SnappyTests */ = { + isa = PBXGroup; + children = ( + EE91728C19CB304E007888CF /* SnappyTests.swift */, + EE91728A19CB304E007888CF /* Supporting Files */, ); path = SnappyTests; sourceTree = ""; }; + EE91728A19CB304E007888CF /* Supporting Files */ = { + isa = PBXGroup; + children = ( + EE91728B19CB304E007888CF /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + EEBCC9D519CC627D0083B827 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ - DDC9FD941981B4DD009612C7 /* Snappy */ = { + EEBCC9D719CC627D0083B827 /* Snappy */ = { isa = PBXNativeTarget; - buildConfigurationList = DDC9FDB11981B4DD009612C7 /* Build configuration list for PBXNativeTarget "Snappy" */; + buildConfigurationList = EEBCC9E819CC627E0083B827 /* Build configuration list for PBXNativeTarget "Snappy" */; buildPhases = ( - DDC9FD911981B4DD009612C7 /* Sources */, - DDC9FD921981B4DD009612C7 /* Frameworks */, - DDC9FD931981B4DD009612C7 /* Resources */, + EEBCC9D319CC627D0083B827 /* Sources */, + EEBCC9D419CC627D0083B827 /* Frameworks */, + EEBCC9D519CC627D0083B827 /* Headers */, + EEBCC9D619CC627D0083B827 /* Resources */, ); buildRules = ( ); @@ -142,27 +140,24 @@ ); name = Snappy; productName = Snappy; - productReference = DDC9FD951981B4DD009612C7 /* Snappy.app */; - productType = "com.apple.product-type.application"; + productReference = EEBCC9D819CC627D0083B827 /* Snappy.framework */; + productType = "com.apple.product-type.framework"; }; - DDC9FDA61981B4DD009612C7 /* SnappyTests */ = { + EEBCC9E119CC627D0083B827 /* SnappyTests */ = { isa = PBXNativeTarget; - buildConfigurationList = DDC9FDB41981B4DD009612C7 /* Build configuration list for PBXNativeTarget "SnappyTests" */; + buildConfigurationList = EEBCC9EB19CC627E0083B827 /* Build configuration list for PBXNativeTarget "SnappyTests" */; buildPhases = ( - DDC9FDA31981B4DD009612C7 /* Sources */, - DDC9FDA41981B4DD009612C7 /* Frameworks */, - DDC9FDA51981B4DD009612C7 /* Resources */, + EEBCC9DE19CC627D0083B827 /* Sources */, + EEBCC9DF19CC627D0083B827 /* Frameworks */, + EEBCC9E019CC627D0083B827 /* Resources */, ); buildRules = ( ); dependencies = ( - DDC9FDA91981B4DD009612C7 /* PBXTargetDependency */, - DD03E31C1981B66800E0DE94 /* PBXTargetDependency */, - DD03E31E1981B66800E0DE94 /* PBXTargetDependency */, ); name = SnappyTests; productName = SnappyTests; - productReference = DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */; + productReference = EEBCC9E219CC627E0083B827 /* SnappyTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -174,12 +169,11 @@ LastUpgradeCheck = 0600; ORGANIZATIONNAME = "Jonas Budelmann"; TargetAttributes = { - DDC9FD941981B4DD009612C7 = { + EEBCC9D719CC627D0083B827 = { CreatedOnToolsVersion = 6.0; }; - DDC9FDA61981B4DD009612C7 = { + EEBCC9E119CC627D0083B827 = { CreatedOnToolsVersion = 6.0; - TestTargetID = DDC9FD941981B4DD009612C7; }; }; }; @@ -196,22 +190,21 @@ projectDirPath = ""; projectRoot = ""; targets = ( - DDC9FD941981B4DD009612C7 /* Snappy */, - DDC9FDA61981B4DD009612C7 /* SnappyTests */, + EEBCC9D719CC627D0083B827 /* Snappy */, + EEBCC9E119CC627D0083B827 /* SnappyTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - DDC9FD931981B4DD009612C7 /* Resources */ = { + EEBCC9D619CC627D0083B827 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - DD03E3171981B52F00E0DE94 /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - DDC9FDA51981B4DD009612C7 /* Resources */ = { + EEBCC9E019CC627D0083B827 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -221,48 +214,30 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - DDC9FD911981B4DD009612C7 /* Sources */ = { + EEBCC9D319CC627D0083B827 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - DD03E32A1981B7BF00E0DE94 /* View.swift in Sources */, - DD03E3221981B71C00E0DE94 /* Constraint.swift in Sources */, - EEC6EB4E1985370500C27B12 /* LayoutConstraint.swift in Sources */, - EE1004CB198879AD006CC759 /* Insets.swift in Sources */, - DD03E3241981B72A00E0DE94 /* ConstraintMaker.swift in Sources */, - DD03E3191981B52F00E0DE94 /* ViewController.swift in Sources */, - DD03E3151981B52F00E0DE94 /* AppDelegate.swift in Sources */, + EEBCC9F019CC64F80083B827 /* EdgeInsets.swift in Sources */, + EEBCC9F619CC65200083B827 /* ConstraintRelation.swift in Sources */, + EEBCC9F419CC65110083B827 /* ConstraintAttributes.swift in Sources */, + EEBCC9FE19CC65510083B827 /* LayoutConstraint.swift in Sources */, + EEBCC9FC19CC65430083B827 /* ConstraintMaker.swift in Sources */, + EEBCC9F219CC65050083B827 /* View+Snappy.swift in Sources */, + EEBCCA0019CC66020083B827 /* Constraint.swift in Sources */, + EEBCC9F819CC65260083B827 /* ConstraintItem.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - DDC9FDA31981B4DD009612C7 /* Sources */ = { + EEBCC9DE19CC627D0083B827 /* 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; @@ -298,7 +273,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -335,7 +310,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -343,32 +318,51 @@ }; name = Release; }; - DDC9FDB21981B4DD009612C7 /* Debug */ = { + EEBCC9E919CC627E0083B827 /* 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"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = Snappy/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Debug; }; - DDC9FDB31981B4DD009612C7 /* Release */ = { + EEBCC9EA19CC627E0083B827 /* 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"; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Snappy/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Release; }; - DDC9FDB51981B4DD009612C7 /* Debug */ = { + EEBCC9EC19CC627E0083B827 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Snappy.app/Snappy"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -377,23 +371,24 @@ "DEBUG=1", "$(inherited)", ); + INFOPLIST_FILE = SnappyTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Debug; }; - DDC9FDB61981B4DD009612C7 /* Release */ = { + EEBCC9ED19CC627E0083B827 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Snappy.app/Snappy"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); + INFOPLIST_FILE = SnappyTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Release; }; @@ -409,23 +404,21 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DDC9FDB11981B4DD009612C7 /* Build configuration list for PBXNativeTarget "Snappy" */ = { + EEBCC9E819CC627E0083B827 /* Build configuration list for PBXNativeTarget "Snappy" */ = { isa = XCConfigurationList; buildConfigurations = ( - DDC9FDB21981B4DD009612C7 /* Debug */, - DDC9FDB31981B4DD009612C7 /* Release */, + EEBCC9E919CC627E0083B827 /* Debug */, + EEBCC9EA19CC627E0083B827 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; }; - DDC9FDB41981B4DD009612C7 /* Build configuration list for PBXNativeTarget "SnappyTests" */ = { + EEBCC9EB19CC627E0083B827 /* Build configuration list for PBXNativeTarget "SnappyTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - DDC9FDB51981B4DD009612C7 /* Debug */, - DDC9FDB61981B4DD009612C7 /* Release */, + EEBCC9EC19CC627E0083B827 /* Debug */, + EEBCC9ED19CC627E0083B827 /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/Snappy/Constraint.swift b/Snappy/Constraint.swift index 5b12e78..8eaec55 100644 --- a/Snappy/Constraint.swift +++ b/Snappy/Constraint.swift @@ -1,5 +1,4 @@ // -// Constraint.swift // Snappy // // Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry @@ -28,280 +27,164 @@ import UIKit import AppKit #endif -/** - * ConstraintAttributes is an options set that maps to NSLayoutAttributes. - */ -struct ConstraintAttributes: RawOptionSetType, BooleanType { - - var value: UInt - var boolValue: Bool { - return self.value != 0 - } - - init(_ value: UInt) { - self.value = value - } - func toRaw() -> UInt { return self.value } - func getLogicValue() -> Bool { return self.value != 0 } - static var allZeros: ConstraintAttributes { return self(0) } - static func fromRaw(raw: UInt) -> ConstraintAttributes? { return self(raw) } - static func fromMask(raw: UInt) -> ConstraintAttributes { return self(raw) } - static func convertFromNilLiteral() -> ConstraintAttributes { return self(0) } - - static var None: ConstraintAttributes { return self(0) } - static var Left: ConstraintAttributes { return self(1) } - static var Top: ConstraintAttributes { return self(2) } - static var Right: ConstraintAttributes { return self(4) } - static var Bottom: ConstraintAttributes { return self(8) } - static var Leading: ConstraintAttributes { return self(16) } - static var Trailing: ConstraintAttributes { return self(32) } - static var Width: ConstraintAttributes { return self(64) } - static var Height: ConstraintAttributes { return self(128) } - static var CenterX: ConstraintAttributes { return self(256) } - static var CenterY: ConstraintAttributes { return self(512) } - static var Baseline: ConstraintAttributes { return self(1024) } - - static var Edges: ConstraintAttributes { return self(15) } - static var Size: ConstraintAttributes { return self(192) } - static var Center: ConstraintAttributes { return self(768) } - - var layoutAttributes:Array { - var attrs: Array = [] - if (self & ConstraintAttributes.Left) { - attrs.append(.Left) - } - if (self & ConstraintAttributes.Top) { - attrs.append(.Top) - } - if (self & ConstraintAttributes.Right) { - attrs.append(.Right) - } - if (self & ConstraintAttributes.Bottom) { - attrs.append(.Bottom) - } - if (self & ConstraintAttributes.Leading) { - attrs.append(.Leading) - } - if (self & ConstraintAttributes.Trailing) { - attrs.append(.Trailing) - } - if (self & ConstraintAttributes.Width) { - attrs.append(.Width) - } - if (self & ConstraintAttributes.Height) { - attrs.append(.Height) - } - if (self & ConstraintAttributes.CenterX) { - attrs.append(.CenterX) - } - if (self & ConstraintAttributes.CenterY) { - attrs.append(.CenterY) - } - if (self & ConstraintAttributes.Baseline) { - attrs.append(.Baseline) - } - return attrs - } -} -func += (inout left: ConstraintAttributes, right: ConstraintAttributes) { - left = (left | right) -} -func -= (inout left: ConstraintAttributes, right: ConstraintAttributes) { - left = left & ~right -} - -/** - * ConstraintRelation is an Int enum that maps to NSLayoutRelation. - */ -enum ConstraintRelation: Int { - case Equal = 1, LessThanOrEqualTo, GreaterThanOrEqualTo - - var layoutRelation: NSLayoutRelation { - get { - switch(self) { - case .LessThanOrEqualTo: - return .LessThanOrEqual - case .GreaterThanOrEqualTo: - return .GreaterThanOrEqual - default: - return .Equal - } - } - } -} - -/** - * ConstraintItem is a class that is used while building constraints. - */ -class ConstraintItem { - - init(view: View?, attributes: ConstraintAttributes) { - self.view = view - self.attributes = attributes - } - - internal weak var view: View? - internal var attributes: ConstraintAttributes -} - /** * Constraint is a single item that defines all the properties for a single ConstraintMaker chain */ -class Constraint { - var left: Constraint { return addConstraint(ConstraintAttributes.Left) } - var top: Constraint { return addConstraint(ConstraintAttributes.Top) } - var right: Constraint { return addConstraint(ConstraintAttributes.Right) } - var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) } - var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) } - var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) } - var width: Constraint { return addConstraint(ConstraintAttributes.Width) } - var height: Constraint { return addConstraint(ConstraintAttributes.Height) } - var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) } - var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) } - var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) } +public class Constraint { + public var left: Constraint { return addConstraint(ConstraintAttributes.Left) } + public var top: Constraint { return addConstraint(ConstraintAttributes.Top) } + public var right: Constraint { return addConstraint(ConstraintAttributes.Right) } + public var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) } + public var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) } + public var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) } + public var width: Constraint { return addConstraint(ConstraintAttributes.Width) } + public var height: Constraint { return addConstraint(ConstraintAttributes.Height) } + public var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) } + public var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) } + public var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) } - var and: Constraint { return self } - var with: Constraint { return self } + public var and: Constraint { return self } + public var with: Constraint { return self } // MARK: initializer - init(fromItem: ConstraintItem) { + internal init(fromItem: ConstraintItem) { self.fromItem = fromItem self.toItem = ConstraintItem(view: nil, attributes: ConstraintAttributes.None) } // MARK: equalTo - func equalTo(other: ConstraintItem) -> Constraint { + public func equalTo(other: ConstraintItem) -> Constraint { return constrainTo(other, relation: .Equal) } - func equalTo(other: View) -> Constraint { + public func equalTo(other: View) -> Constraint { return constrainTo(other, relation: .Equal) } - func equalTo(other: Float) -> Constraint { + public func equalTo(other: Float) -> Constraint { return constrainTo(other, relation: .Equal) } - func equalTo(other: Int) -> Constraint { + public func equalTo(other: Int) -> Constraint { return constrainTo(Float(other), relation: .Equal) } - func equalTo(other: CGSize) -> Constraint { + public func equalTo(other: CGSize) -> Constraint { return constrainTo(other, relation: .Equal) } - func equalTo(other: CGPoint) -> Constraint { + public func equalTo(other: CGPoint) -> Constraint { return constrainTo(other, relation: .Equal) } - func equalTo(other: EdgeInsets) -> Constraint { + public func equalTo(other: EdgeInsets) -> Constraint { return constrainTo(other, relation: .Equal) } // MARK: lessThanOrEqualTo - func lessThanOrEqualTo(other: ConstraintItem) -> Constraint { + public func lessThanOrEqualTo(other: ConstraintItem) -> Constraint { return constrainTo(other, relation: .LessThanOrEqualTo) } - func lessThanOrEqualTo(other: View) -> Constraint { + public func lessThanOrEqualTo(other: View) -> Constraint { return constrainTo(other, relation: .LessThanOrEqualTo) } - func lessThanOrEqualTo(other: Float) -> Constraint { + public func lessThanOrEqualTo(other: Float) -> Constraint { return constrainTo(other, relation: .LessThanOrEqualTo) } - func lessThanOrEqualTo(other: Int) -> Constraint { + public func lessThanOrEqualTo(other: Int) -> Constraint { return constrainTo(Float(other), relation: .LessThanOrEqualTo) } - func lessThanOrEqualTo(other: CGSize) -> Constraint { + public func lessThanOrEqualTo(other: CGSize) -> Constraint { return constrainTo(other, relation: .LessThanOrEqualTo) } - func lessThanOrEqualTo(other: CGPoint) -> Constraint { + public func lessThanOrEqualTo(other: CGPoint) -> Constraint { return constrainTo(other, relation: .LessThanOrEqualTo) } - func lessThanOrEqualTo(other: EdgeInsets) -> Constraint { + public func lessThanOrEqualTo(other: EdgeInsets) -> Constraint { return constrainTo(other, relation: .LessThanOrEqualTo) } // MARK: greaterThanOrEqualTo - func greaterThanOrEqualTo(other: ConstraintItem) -> Constraint { + public func greaterThanOrEqualTo(other: ConstraintItem) -> Constraint { return constrainTo(other, relation: .GreaterThanOrEqualTo) } func greaterThanOrEqualTo(other: View) -> Constraint { return constrainTo(other, relation: .GreaterThanOrEqualTo) } - func greaterThanOrEqualTo(other: Float) -> Constraint { + public func greaterThanOrEqualTo(other: Float) -> Constraint { return constrainTo(other, relation: .GreaterThanOrEqualTo) } - func greaterThanOrEqualTo(other: Int) -> Constraint { + public func greaterThanOrEqualTo(other: Int) -> Constraint { return constrainTo(Float(other), relation: .GreaterThanOrEqualTo) } - func greaterThanOrEqualTo(other: CGSize) -> Constraint { + public func greaterThanOrEqualTo(other: CGSize) -> Constraint { return constrainTo(other, relation: .GreaterThanOrEqualTo) } - func greaterThanOrEqualTo(other: CGPoint) -> Constraint { + public func greaterThanOrEqualTo(other: CGPoint) -> Constraint { return constrainTo(other, relation: .GreaterThanOrEqualTo) } - func greaterThanOrEqualTo(other: EdgeInsets) -> Constraint { + public func greaterThanOrEqualTo(other: EdgeInsets) -> Constraint { return constrainTo(other, relation: .GreaterThanOrEqualTo) } // MARK: multiplier - func multipliedBy(amount: Float) -> Constraint { + public func multipliedBy(amount: Float) -> Constraint { self.multiplier = amount return self } - func dividedBy(amount: Float) -> Constraint { + public func dividedBy(amount: Float) -> Constraint { self.multiplier = 1.0 / amount; return self } // MARK: priority - func priority(priority: Float) -> Constraint { + public func priority(priority: Float) -> Constraint { self.priority = priority return self } - func priorityRequired() -> Constraint { + public func priorityRequired() -> Constraint { return priority(1000.0) } - func priorityHigh() -> Constraint { + public func priorityHigh() -> Constraint { return priority(750.0) } - func priorityLow() -> Constraint { + public func priorityLow() -> Constraint { return priority(250.0) } // MARK: offset - func offset(amount: Float) -> Constraint { + public func offset(amount: Float) -> Constraint { self.offset = amount return self } - func offset(amount: Int) -> Constraint { + public func offset(amount: Int) -> Constraint { self.offset = amount return self } - func offset(amount: CGPoint) -> Constraint { + public func offset(amount: CGPoint) -> Constraint { self.offset = amount return self } - func offset(amount: CGSize) -> Constraint { + public func offset(amount: CGSize) -> Constraint { self.offset = amount return self } - func offset(amount: EdgeInsets) -> Constraint { + public func offset(amount: EdgeInsets) -> Constraint { self.offset = amount return self } // MARK: insets - func insets(amount: EdgeInsets) -> Constraint { + public func insets(amount: EdgeInsets) -> Constraint { self.offset = amount return self } // MARK: install - func install() -> Array { + public func install() -> Array { var installOnView: View? = nil if self.toItem.view != nil { installOnView = Constraint.closestCommonSuperviewFromView(self.fromItem.view, toView: self.toItem.view) @@ -343,7 +226,7 @@ class Constraint { // create layout constraint let layoutConstraint = LayoutConstraint( - item: layoutFrom, + item: layoutFrom!, attribute: layoutFromAttribute, relatedBy: layoutRelation, toItem: layoutTo, @@ -368,12 +251,12 @@ class Constraint { // MARK: uninstall - func uninstall() { + public func uninstall() { if let view = self.installedOnView { #if os(iOS) - var installedConstraints = view.constraints() - #else - var installedConstraints = view.constraints + var installedConstraints = view.constraints() + #else + var installedConstraints = view.constraints #endif var constraintsToRemove: Array = [] for installedConstraint in installedConstraints { @@ -464,20 +347,20 @@ class Constraint { private extension NSLayoutAttribute { - func snp_offsetForValue(value: Any?) -> CGFloat { + private func snp_offsetForValue(value: Any?) -> CGFloat { // Float if let float = value as? Float { return CGFloat(float) } - // Int + // Int else if let int = value as? Int { return CGFloat(int) } - // CGFloat + // CGFloat else if let float = value as? CGFloat { return float } - // CGSize + // CGSize else if let size = value as? CGSize { if self == .Width { return size.width @@ -485,7 +368,7 @@ private extension NSLayoutAttribute { return size.height } } - // CGPoint + // CGPoint else if let point = value as? CGPoint { if self == .Left || self == .CenterX { return point.x @@ -497,7 +380,7 @@ private extension NSLayoutAttribute { return -point.y } } - // EdgeInsets + // EdgeInsets else if let insets = value as? EdgeInsets { if self == .Left { return insets.left @@ -513,20 +396,20 @@ private extension NSLayoutAttribute { return CGFloat(0) } - func snp_constantForValue(value: Any?) -> CGFloat { + private func snp_constantForValue(value: Any?) -> CGFloat { // Float if let float = value as? Float { return CGFloat(float) } - // Int + // Int else if let int = value as? Int { return CGFloat(int) } - // CGFloat + // CGFloat else if let float = value as? CGFloat { return float } - // CGSize + // CGSize else if let size = value as? CGSize { if self == .Width { return size.width @@ -534,7 +417,7 @@ private extension NSLayoutAttribute { return size.height } } - // CGPoint + // CGPoint else if let point = value as? CGPoint { if self == .Left || self == .CenterX { return point.x @@ -546,7 +429,7 @@ private extension NSLayoutAttribute { return point.y } } - // EdgeInsets + // EdgeInsets else if let insets = value as? EdgeInsets { if self == .Left { return insets.left @@ -561,4 +444,4 @@ private extension NSLayoutAttribute { return CGFloat(0); } -} +} \ No newline at end of file diff --git a/Snappy/ConstraintAttributes.swift b/Snappy/ConstraintAttributes.swift new file mode 100644 index 0000000..36c566b --- /dev/null +++ b/Snappy/ConstraintAttributes.swift @@ -0,0 +1,114 @@ +// +// Snappy +// +// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if os(iOS) +import UIKit +#else +import AppKit +#endif + +/** + * ConstraintAttributes is an options set that maps to NSLayoutAttributes. + */ +internal struct ConstraintAttributes: RawOptionSetType, BooleanType { + + internal init(rawValue: UInt) { + self.rawValue = rawValue + } + internal init(_ rawValue: UInt) { + self.init(rawValue: rawValue) + } + + internal private(set) var rawValue: UInt + internal static var allZeros: ConstraintAttributes { return self(0) } + internal static func convertFromNilLiteral() -> ConstraintAttributes { return self(0) } + internal var boolValue: Bool { return self.rawValue != 0 } + + func toRaw() -> UInt { return self.rawValue } + static func fromRaw(raw: UInt) -> ConstraintAttributes? { return self(raw) } + static func fromMask(raw: UInt) -> ConstraintAttributes { return self(raw) } + + internal static var None: ConstraintAttributes { return self(0) } + internal static var Left: ConstraintAttributes { return self(1) } + internal static var Top: ConstraintAttributes { return self(2) } + internal static var Right: ConstraintAttributes { return self(4) } + internal static var Bottom: ConstraintAttributes { return self(8) } + internal static var Leading: ConstraintAttributes { return self(16) } + internal static var Trailing: ConstraintAttributes { return self(32) } + internal static var Width: ConstraintAttributes { return self(64) } + internal static var Height: ConstraintAttributes { return self(128) } + internal static var CenterX: ConstraintAttributes { return self(256) } + internal static var CenterY: ConstraintAttributes { return self(512) } + internal static var Baseline: ConstraintAttributes { return self(1024) } + + internal static var Edges: ConstraintAttributes { return self(15) } + internal static var Size: ConstraintAttributes { return self(192) } + internal static var Center: ConstraintAttributes { return self(768) } + + internal var layoutAttributes:Array { + var attrs: Array = [] + if (self & ConstraintAttributes.Left) { + attrs.append(.Left) + } + if (self & ConstraintAttributes.Top) { + attrs.append(.Top) + } + if (self & ConstraintAttributes.Right) { + attrs.append(.Right) + } + if (self & ConstraintAttributes.Bottom) { + attrs.append(.Bottom) + } + if (self & ConstraintAttributes.Leading) { + attrs.append(.Leading) + } + if (self & ConstraintAttributes.Trailing) { + attrs.append(.Trailing) + } + if (self & ConstraintAttributes.Width) { + attrs.append(.Width) + } + if (self & ConstraintAttributes.Height) { + attrs.append(.Height) + } + if (self & ConstraintAttributes.CenterX) { + attrs.append(.CenterX) + } + if (self & ConstraintAttributes.CenterY) { + attrs.append(.CenterY) + } + if (self & ConstraintAttributes.Baseline) { + attrs.append(.Baseline) + } + return attrs + } +} +internal func += (inout left: ConstraintAttributes, right: ConstraintAttributes) { + left = (left | right) +} +internal func -= (inout left: ConstraintAttributes, right: ConstraintAttributes) { + left = left & ~right +} +internal func == (left: ConstraintAttributes, right: ConstraintAttributes) -> Bool { + return left.rawValue == right.rawValue +} diff --git a/Snappy/ConstraintItem.swift b/Snappy/ConstraintItem.swift new file mode 100644 index 0000000..557af6d --- /dev/null +++ b/Snappy/ConstraintItem.swift @@ -0,0 +1,42 @@ +// +// Snappy +// +// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if os(iOS) +import UIKit +#else +import AppKit +#endif + +/** + * ConstraintItem is a class that is used while building constraints. + */ +public class ConstraintItem { + + internal init(view: View?, attributes: ConstraintAttributes) { + self.view = view + self.attributes = attributes + } + + internal weak var view: View? + internal var attributes: ConstraintAttributes +} \ No newline at end of file diff --git a/Snappy/ConstraintMaker.swift b/Snappy/ConstraintMaker.swift index d9aa417..0a1179b 100644 --- a/Snappy/ConstraintMaker.swift +++ b/Snappy/ConstraintMaker.swift @@ -1,5 +1,4 @@ // -// ConstraintMaker.swift // Snappy // // Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry @@ -31,22 +30,22 @@ import AppKit /** * ConstraintMaker is the maker in snappy that gets all constraints kickstarted */ -class ConstraintMaker { - var left: Constraint { return addConstraint(ConstraintAttributes.Left) } - var top: Constraint { return addConstraint(ConstraintAttributes.Top) } - var right: Constraint { return addConstraint(ConstraintAttributes.Right) } - var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) } - var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) } - var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) } - var width: Constraint { return addConstraint(ConstraintAttributes.Width) } - var height: Constraint { return addConstraint(ConstraintAttributes.Height) } - var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) } - var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) } - var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) } +public class ConstraintMaker { + public var left: Constraint { return addConstraint(ConstraintAttributes.Left) } + public var top: Constraint { return addConstraint(ConstraintAttributes.Top) } + public var right: Constraint { return addConstraint(ConstraintAttributes.Right) } + public var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) } + public var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) } + public var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) } + public var width: Constraint { return addConstraint(ConstraintAttributes.Width) } + public var height: Constraint { return addConstraint(ConstraintAttributes.Height) } + public var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) } + public var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) } + public var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) } - var edges: Constraint { return addConstraint(ConstraintAttributes.Edges) } - var size: Constraint { return addConstraint(ConstraintAttributes.Size) } - var center: Constraint { return addConstraint(ConstraintAttributes.Center) } + public var edges: Constraint { return addConstraint(ConstraintAttributes.Edges) } + public var size: Constraint { return addConstraint(ConstraintAttributes.Size) } + public var center: Constraint { return addConstraint(ConstraintAttributes.Center) } init(view: View) { self.view = view @@ -98,5 +97,4 @@ class ConstraintMaker { } LayoutConstraint.setLayoutConstraints(layoutConstraints, installedOnView: view) } -} - +} \ No newline at end of file diff --git a/Snappy/ConstraintRelation.swift b/Snappy/ConstraintRelation.swift new file mode 100644 index 0000000..40d5b44 --- /dev/null +++ b/Snappy/ConstraintRelation.swift @@ -0,0 +1,48 @@ +// +// Snappy +// +// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if os(iOS) +import UIKit +#else +import AppKit +#endif + +/** + * ConstraintRelation is an Int enum that maps to NSLayoutRelation. + */ +internal enum ConstraintRelation: Int { + case Equal = 1, LessThanOrEqualTo, GreaterThanOrEqualTo + + internal var layoutRelation: NSLayoutRelation { + get { + switch(self) { + case .LessThanOrEqualTo: + return .LessThanOrEqual + case .GreaterThanOrEqualTo: + return .GreaterThanOrEqual + default: + return .Equal + } + } + } +} \ No newline at end of file diff --git a/Snappy/Insets.swift b/Snappy/EdgeInsets.swift similarity index 68% rename from Snappy/Insets.swift rename to Snappy/EdgeInsets.swift index 0f43c98..a73204e 100644 --- a/Snappy/Insets.swift +++ b/Snappy/EdgeInsets.swift @@ -1,5 +1,4 @@ // -// Insets.swift // Snappy // // Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry @@ -22,24 +21,23 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - #if os(iOS) import UIKit -typealias EdgeInsets = UIEdgeInsets -func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets { +public typealias EdgeInsets = UIEdgeInsets +public func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets { return EdgeInsets(top: top, left: left, bottom: bottom, right: right) } -let EdgeInsetsZero = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0) +public let EdgeInsetsZero = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0) #else import AppKit -struct EdgeInsets { - var top: CGFloat // specify amount to inset (positive) for each of the edges. values can be negative to 'outset' - var left: CGFloat - var bottom: CGFloat - var right: CGFloat +public struct EdgeInsets { + public var top: CGFloat // specify amount to inset (positive) for each of the edges. values can be negative to 'outset' + public var left: CGFloat + public var bottom: CGFloat + public var right: CGFloat } -func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets { +public func EdgeInsetsMake(top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) -> EdgeInsets { return EdgeInsets(top: top, left: left, bottom: bottom, right: right) } -let EdgeInsetsZero = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0) +public let EdgeInsetsZero = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0) #endif diff --git a/Snappy/Info.plist b/Snappy/Info.plist new file mode 100644 index 0000000..7613312 --- /dev/null +++ b/Snappy/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.masonry.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/Snappy/LayoutConstraint.swift b/Snappy/LayoutConstraint.swift index 5ccb212..815f7e3 100644 --- a/Snappy/LayoutConstraint.swift +++ b/Snappy/LayoutConstraint.swift @@ -1,5 +1,4 @@ // -// LayoutConstraint.swift // Snappy // // Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry @@ -29,9 +28,9 @@ import AppKit #endif /** - * LayoutConstraint is a subclass of NSLayoutConstraint to assist Snappy and also provide better debugging - */ -class LayoutConstraint: NSLayoutConstraint { +* LayoutConstraint is a subclass of NSLayoutConstraint to assist Snappy and also provide better debugging +*/ +public class LayoutConstraint: NSLayoutConstraint { // internal diff --git a/Snappy/Snappy.h b/Snappy/Snappy.h new file mode 100644 index 0000000..890a94f --- /dev/null +++ b/Snappy/Snappy.h @@ -0,0 +1,30 @@ +// +// Snappy +// +// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +//! Project version number for Snappy. +FOUNDATION_EXPORT double SnappyVersionNumber; + +//! Project version string for Snappy. +FOUNDATION_EXPORT const unsigned char SnappyVersionString[]; \ No newline at end of file diff --git a/Snappy/View+Snappy.swift b/Snappy/View+Snappy.swift new file mode 100644 index 0000000..abb5a41 --- /dev/null +++ b/Snappy/View+Snappy.swift @@ -0,0 +1,56 @@ +// +// Snappy +// +// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if os(iOS) +import UIKit +public typealias View = UIView +#else +import AppKit +public typealias View = NSView +#endif + +public extension View { + public var snp_left: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Left) } + public var snp_top: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Top) } + public var snp_right: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Right) } + public var snp_bottom: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Bottom) } + public var snp_leading: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Leading) } + public var snp_trailing: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Trailing) } + public var snp_width: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Width) } + public var snp_height: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Height) } + public var snp_centerX: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.CenterX) } + public var snp_centerY: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.CenterY) } + public var snp_baseline: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Baseline) } + + public var snp_edges: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Edges) } + public var snp_size: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Size) } + public var snp_center: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Center) } + + public func snp_makeConstraints(block: (maker: ConstraintMaker) -> ()) { + ConstraintMaker.makeConstraints(self, block: block) + } + + public func snp_remakeConstraints(block: (maker: ConstraintMaker) -> ()) { + ConstraintMaker.remakeConstraints(self, block: block) + } +} \ No newline at end of file diff --git a/Snappy/View.swift b/Snappy/View.swift deleted file mode 100644 index 8167f8b..0000000 --- a/Snappy/View.swift +++ /dev/null @@ -1,85 +0,0 @@ -// -// View.swift -// Snappy -// -// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#if os(iOS) -import UIKit -typealias View = UIView -#else -import AppKit -typealias View = NSView -#endif - -extension View { -#if SNP_SHORTHAND - var left: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Left) } - var top: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Top) } - var right: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Right) } - var bottom: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Bottom) } - var leading: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Leading) } - var trailing: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Trailing) } - var width: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Width) } - var height: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Height) } - var centerX: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.CenterX) } - var centerY: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.CenterY) } - var baseline: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Baseline) } - - var edges: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Edges) } - var size: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Size) } - var center: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Center) } - - func makeConstraints(block: (maker: ConstraintMaker) -> ()) { - ConstraintMaker.makeConstraints(self, block: block) - } - - func remakeConstraints(block: (maker: ConstraintMaker) -> ()) { - ConstraintMaker.remakeConstraints(self, block: block) - } -#else - var snp_left: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Left) } - var snp_top: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Top) } - var snp_right: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Right) } - var snp_bottom: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Bottom) } - var snp_leading: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Leading) } - var snp_trailing: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Trailing) } - var snp_width: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Width) } - var snp_height: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Height) } - var snp_centerX: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.CenterX) } - var snp_centerY: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.CenterY) } - var snp_baseline: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Baseline) } - - var snp_edges: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Edges) } - var snp_size: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Size) } - var snp_center: ConstraintItem { return ConstraintItem(view: self, attributes: ConstraintAttributes.Center) } - - func snp_makeConstraints(block: (maker: ConstraintMaker) -> ()) { - ConstraintMaker.makeConstraints(self, block: block) - } - - func snp_remakeConstraints(block: (maker: ConstraintMaker) -> ()) { - ConstraintMaker.remakeConstraints(self, block: block) - } - -#endif -} - diff --git a/SnappyExample/AppDelegate.swift b/SnappyExample/AppDelegate.swift deleted file mode 100644 index f9ef11e..0000000 --- a/SnappyExample/AppDelegate.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.swift -// Snappy -// -// Created by Jonas Budelmann on 25/07/14. -// Copyright (c) 2014 Jonas Budelmann. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - 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 - } -} - diff --git a/SnappyExample/Images.xcassets/AppIcon.appiconset/Contents.json b/SnappyExample/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 91bf9c1..0000000 --- a/SnappyExample/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/SnappyExample/Images.xcassets/LaunchImage.launchimage/Contents.json b/SnappyExample/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 6f870a4..0000000 --- a/SnappyExample/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/SnappyExample/Info.plist b/SnappyExample/Info.plist deleted file mode 100644 index afcc4fa..0000000 --- a/SnappyExample/Info.plist +++ /dev/null @@ -1,43 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.cloudling.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/SnappyExample/ViewController.swift b/SnappyExample/ViewController.swift deleted file mode 100644 index 4dc0ad5..0000000 --- a/SnappyExample/ViewController.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// 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(frame: CGRectZero) - 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 = EdgeInsets(top: 15, left: 10, bottom: 15, right: 10) - - - view1.snp_makeConstraints { make in - make.top.and.left.equalTo(CGPointZero).insets(padding) - make.size.equalTo(CGSizeMake(100, 50)) - } - - view2.snp_makeConstraints { make in - make.centerX.equalTo(view1.snp_centerX).offset(CGPointMake(50, 0)) - make.top.equalTo(view1.snp_bottom).offset(50) - make.width.equalTo(view1.snp_height) - make.height.equalTo(view1.snp_width) - } - - view3.snp_makeConstraints { make in - make.width.height.greaterThanOrEqualTo(view1) - make.width.height.greaterThanOrEqualTo(view2) - make.center.equalTo(superview) - } - - } - -} - diff --git a/SnappyTests/Info.plist b/SnappyTests/Info.plist new file mode 100644 index 0000000..1235593 --- /dev/null +++ b/SnappyTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.masonry.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/SnappyTests/SnappyTests.swift b/SnappyTests/SnappyTests.swift index cce0ab6..034f59a 100644 --- a/SnappyTests/SnappyTests.swift +++ b/SnappyTests/SnappyTests.swift @@ -2,7 +2,7 @@ // SnappyTests.swift // SnappyTests // -// Created by Jonas Budelmann on 25/07/14. +// Created by Robert Payne on 20/09/14. // Copyright (c) 2014 Jonas Budelmann. All rights reserved. //