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
This commit is contained in:
Robert Payne 2014-09-23 16:28:00 +12:00
parent 236e62521d
commit 9685c27a29
19 changed files with 584 additions and 690 deletions

View File

@ -7,65 +7,42 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
DD03E3151981B52F00E0DE94 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E30F1981B52F00E0DE94 /* AppDelegate.swift */; }; EEBCC9F019CC64F80083B827 /* EdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9EF19CC64F70083B827 /* EdgeInsets.swift */; };
DD03E3171981B52F00E0DE94 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD03E3121981B52F00E0DE94 /* Images.xcassets */; }; EEBCC9F219CC65050083B827 /* View+Snappy.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F119CC65040083B827 /* View+Snappy.swift */; };
DD03E3191981B52F00E0DE94 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3141981B52F00E0DE94 /* ViewController.swift */; }; EEBCC9F419CC65110083B827 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F319CC65110083B827 /* ConstraintAttributes.swift */; };
DD03E3221981B71C00E0DE94 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3211981B71C00E0DE94 /* Constraint.swift */; }; EEBCC9F619CC65200083B827 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F519CC65200083B827 /* ConstraintRelation.swift */; };
DD03E3241981B72A00E0DE94 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */; }; EEBCC9F819CC65260083B827 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9F719CC65260083B827 /* ConstraintItem.swift */; };
DD03E32A1981B7BF00E0DE94 /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD03E3291981B7BF00E0DE94 /* View.swift */; }; EEBCC9FC19CC65430083B827 /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9FB19CC65430083B827 /* ConstraintMaker.swift */; };
DDC9FDAE1981B4DD009612C7 /* SnappyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */; }; EEBCC9FE19CC65510083B827 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9FD19CC65510083B827 /* LayoutConstraint.swift */; };
EE1004CB198879AD006CC759 /* Insets.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE1004CA198879AD006CC759 /* Insets.swift */; }; EEBCCA0019CC66020083B827 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEBCC9FF19CC66020083B827 /* Constraint.swift */; };
EEC6EB4E1985370500C27B12 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEC6EB4D1985370500C27B12 /* LayoutConstraint.swift */; };
/* End PBXBuildFile section */ /* 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 */ /* Begin PBXFileReference section */
DD03E30F1981B52F00E0DE94 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; EE91728119CB304E007888CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DD03E3121981B52F00E0DE94 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; }; EE91728219CB304E007888CF /* Snappy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Snappy.h; sourceTree = "<group>"; };
DD03E3131981B52F00E0DE94 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; EE91728B19CB304E007888CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DD03E3141981B52F00E0DE94 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; EE91728C19CB304E007888CF /* SnappyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnappyTests.swift; sourceTree = "<group>"; };
DD03E3211981B71C00E0DE94 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = "<group>"; }; EEBCC9D819CC627D0083B827 /* Snappy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Snappy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = "<group>"; }; EEBCC9E219CC627E0083B827 /* SnappyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SnappyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
DD03E3291981B7BF00E0DE94 /* View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; }; EEBCC9EF19CC64F70083B827 /* EdgeInsets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EdgeInsets.swift; sourceTree = "<group>"; };
DDC9FD951981B4DD009612C7 /* Snappy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Snappy.app; sourceTree = BUILT_PRODUCTS_DIR; }; EEBCC9F119CC65040083B827 /* View+Snappy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "View+Snappy.swift"; sourceTree = "<group>"; };
DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SnappyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; EEBCC9F319CC65110083B827 /* ConstraintAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintAttributes.swift; sourceTree = "<group>"; };
DDC9FDAD1981B4DD009612C7 /* SnappyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnappyTests.swift; sourceTree = "<group>"; }; EEBCC9F519CC65200083B827 /* ConstraintRelation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintRelation.swift; sourceTree = "<group>"; };
EE1004CA198879AD006CC759 /* Insets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Insets.swift; sourceTree = "<group>"; }; EEBCC9F719CC65260083B827 /* ConstraintItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintItem.swift; sourceTree = "<group>"; };
EEC6EB4D1985370500C27B12 /* LayoutConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutConstraint.swift; sourceTree = "<group>"; }; EEBCC9FB19CC65430083B827 /* ConstraintMaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintMaker.swift; sourceTree = "<group>"; };
EEBCC9FD19CC65510083B827 /* LayoutConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutConstraint.swift; sourceTree = "<group>"; };
EEBCC9FF19CC66020083B827 /* Constraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constraint.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
DDC9FD921981B4DD009612C7 /* Frameworks */ = { EEBCC9D419CC627D0083B827 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
DDC9FDA41981B4DD009612C7 /* Frameworks */ = { EEBCC9DF19CC627D0083B827 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
@ -75,35 +52,11 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup 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 = (
EE1004CA198879AD006CC759 /* Insets.swift */,
EEC6EB4D1985370500C27B12 /* LayoutConstraint.swift */,
DD03E3211981B71C00E0DE94 /* Constraint.swift */,
DD03E3231981B72A00E0DE94 /* ConstraintMaker.swift */,
DD03E3291981B7BF00E0DE94 /* View.swift */,
);
path = Snappy;
sourceTree = "<group>";
};
DDC9FD8C1981B4DD009612C7 = { DDC9FD8C1981B4DD009612C7 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
DD03E31A1981B62D00E0DE94 /* Snappy */, EE91727F19CB304E007888CF /* Snappy */,
DD03E30E1981B52F00E0DE94 /* SnappyExample */, EE91728919CB304E007888CF /* SnappyTests */,
DDC9FDAA1981B4DD009612C7 /* SnappyTests */,
DDC9FD961981B4DD009612C7 /* Products */, DDC9FD961981B4DD009612C7 /* Products */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
@ -111,30 +64,75 @@
DDC9FD961981B4DD009612C7 /* Products */ = { DDC9FD961981B4DD009612C7 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
DDC9FD951981B4DD009612C7 /* Snappy.app */, EEBCC9D819CC627D0083B827 /* Snappy.framework */,
DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */, EEBCC9E219CC627E0083B827 /* SnappyTests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DDC9FDAA1981B4DD009612C7 /* SnappyTests */ = { EE91727F19CB304E007888CF /* Snappy */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( 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 = "<group>";
};
EE91728019CB304E007888CF /* Supporting Files */ = {
isa = PBXGroup;
children = (
EE91728119CB304E007888CF /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
EE91728919CB304E007888CF /* SnappyTests */ = {
isa = PBXGroup;
children = (
EE91728C19CB304E007888CF /* SnappyTests.swift */,
EE91728A19CB304E007888CF /* Supporting Files */,
); );
path = SnappyTests; path = SnappyTests;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
EE91728A19CB304E007888CF /* Supporting Files */ = {
isa = PBXGroup;
children = (
EE91728B19CB304E007888CF /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
EEBCC9D519CC627D0083B827 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
DDC9FD941981B4DD009612C7 /* Snappy */ = { EEBCC9D719CC627D0083B827 /* Snappy */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = DDC9FDB11981B4DD009612C7 /* Build configuration list for PBXNativeTarget "Snappy" */; buildConfigurationList = EEBCC9E819CC627E0083B827 /* Build configuration list for PBXNativeTarget "Snappy" */;
buildPhases = ( buildPhases = (
DDC9FD911981B4DD009612C7 /* Sources */, EEBCC9D319CC627D0083B827 /* Sources */,
DDC9FD921981B4DD009612C7 /* Frameworks */, EEBCC9D419CC627D0083B827 /* Frameworks */,
DDC9FD931981B4DD009612C7 /* Resources */, EEBCC9D519CC627D0083B827 /* Headers */,
EEBCC9D619CC627D0083B827 /* Resources */,
); );
buildRules = ( buildRules = (
); );
@ -142,27 +140,24 @@
); );
name = Snappy; name = Snappy;
productName = Snappy; productName = Snappy;
productReference = DDC9FD951981B4DD009612C7 /* Snappy.app */; productReference = EEBCC9D819CC627D0083B827 /* Snappy.framework */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.framework";
}; };
DDC9FDA61981B4DD009612C7 /* SnappyTests */ = { EEBCC9E119CC627D0083B827 /* SnappyTests */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = DDC9FDB41981B4DD009612C7 /* Build configuration list for PBXNativeTarget "SnappyTests" */; buildConfigurationList = EEBCC9EB19CC627E0083B827 /* Build configuration list for PBXNativeTarget "SnappyTests" */;
buildPhases = ( buildPhases = (
DDC9FDA31981B4DD009612C7 /* Sources */, EEBCC9DE19CC627D0083B827 /* Sources */,
DDC9FDA41981B4DD009612C7 /* Frameworks */, EEBCC9DF19CC627D0083B827 /* Frameworks */,
DDC9FDA51981B4DD009612C7 /* Resources */, EEBCC9E019CC627D0083B827 /* Resources */,
); );
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
DDC9FDA91981B4DD009612C7 /* PBXTargetDependency */,
DD03E31C1981B66800E0DE94 /* PBXTargetDependency */,
DD03E31E1981B66800E0DE94 /* PBXTargetDependency */,
); );
name = SnappyTests; name = SnappyTests;
productName = SnappyTests; productName = SnappyTests;
productReference = DDC9FDA71981B4DD009612C7 /* SnappyTests.xctest */; productReference = EEBCC9E219CC627E0083B827 /* SnappyTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test"; productType = "com.apple.product-type.bundle.unit-test";
}; };
/* End PBXNativeTarget section */ /* End PBXNativeTarget section */
@ -174,12 +169,11 @@
LastUpgradeCheck = 0600; LastUpgradeCheck = 0600;
ORGANIZATIONNAME = "Jonas Budelmann"; ORGANIZATIONNAME = "Jonas Budelmann";
TargetAttributes = { TargetAttributes = {
DDC9FD941981B4DD009612C7 = { EEBCC9D719CC627D0083B827 = {
CreatedOnToolsVersion = 6.0; CreatedOnToolsVersion = 6.0;
}; };
DDC9FDA61981B4DD009612C7 = { EEBCC9E119CC627D0083B827 = {
CreatedOnToolsVersion = 6.0; CreatedOnToolsVersion = 6.0;
TestTargetID = DDC9FD941981B4DD009612C7;
}; };
}; };
}; };
@ -196,22 +190,21 @@
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
targets = ( targets = (
DDC9FD941981B4DD009612C7 /* Snappy */, EEBCC9D719CC627D0083B827 /* Snappy */,
DDC9FDA61981B4DD009612C7 /* SnappyTests */, EEBCC9E119CC627D0083B827 /* SnappyTests */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
DDC9FD931981B4DD009612C7 /* Resources */ = { EEBCC9D619CC627D0083B827 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
DD03E3171981B52F00E0DE94 /* Images.xcassets in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
DDC9FDA51981B4DD009612C7 /* Resources */ = { EEBCC9E019CC627D0083B827 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
@ -221,48 +214,30 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
DDC9FD911981B4DD009612C7 /* Sources */ = { EEBCC9D319CC627D0083B827 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
DD03E32A1981B7BF00E0DE94 /* View.swift in Sources */, EEBCC9F019CC64F80083B827 /* EdgeInsets.swift in Sources */,
DD03E3221981B71C00E0DE94 /* Constraint.swift in Sources */, EEBCC9F619CC65200083B827 /* ConstraintRelation.swift in Sources */,
EEC6EB4E1985370500C27B12 /* LayoutConstraint.swift in Sources */, EEBCC9F419CC65110083B827 /* ConstraintAttributes.swift in Sources */,
EE1004CB198879AD006CC759 /* Insets.swift in Sources */, EEBCC9FE19CC65510083B827 /* LayoutConstraint.swift in Sources */,
DD03E3241981B72A00E0DE94 /* ConstraintMaker.swift in Sources */, EEBCC9FC19CC65430083B827 /* ConstraintMaker.swift in Sources */,
DD03E3191981B52F00E0DE94 /* ViewController.swift in Sources */, EEBCC9F219CC65050083B827 /* View+Snappy.swift in Sources */,
DD03E3151981B52F00E0DE94 /* AppDelegate.swift in Sources */, EEBCCA0019CC66020083B827 /* Constraint.swift in Sources */,
EEBCC9F819CC65260083B827 /* ConstraintItem.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
DDC9FDA31981B4DD009612C7 /* Sources */ = { EEBCC9DE19CC627D0083B827 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
DDC9FDAE1981B4DD009612C7 /* SnappyTests.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXSourcesBuildPhase section */ /* 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 */ /* Begin XCBuildConfiguration section */
DDC9FDAF1981B4DD009612C7 /* Debug */ = { DDC9FDAF1981B4DD009612C7 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
@ -298,7 +273,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@ -335,7 +310,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
@ -343,32 +318,51 @@
}; };
name = Release; name = Release;
}; };
DDC9FDB21981B4DD009612C7 /* Debug */ = { EEBCC9E919CC627E0083B827 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEFINES_MODULE = YES;
INFOPLIST_FILE = SnappyExample/Info.plist; DYLIB_COMPATIBILITY_VERSION = 1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 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)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
}; };
name = Debug; name = Debug;
}; };
DDC9FDB31981B4DD009612C7 /* Release */ = { EEBCC9EA19CC627E0083B827 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; DEFINES_MODULE = YES;
INFOPLIST_FILE = SnappyExample/Info.plist; DYLIB_COMPATIBILITY_VERSION = 1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 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)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
}; };
name = Release; name = Release;
}; };
DDC9FDB51981B4DD009612C7 /* Debug */ = { EEBCC9EC19CC627E0083B827 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Snappy.app/Snappy";
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks", "$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)", "$(inherited)",
@ -377,23 +371,24 @@
"DEBUG=1", "DEBUG=1",
"$(inherited)", "$(inherited)",
); );
INFOPLIST_FILE = SnappyTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
}; };
name = Debug; name = Debug;
}; };
DDC9FDB61981B4DD009612C7 /* Release */ = { EEBCC9ED19CC627E0083B827 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Snappy.app/Snappy";
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks", "$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)", "$(inherited)",
); );
INFOPLIST_FILE = SnappyTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
}; };
name = Release; name = Release;
}; };
@ -409,23 +404,21 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
DDC9FDB11981B4DD009612C7 /* Build configuration list for PBXNativeTarget "Snappy" */ = { EEBCC9E819CC627E0083B827 /* Build configuration list for PBXNativeTarget "Snappy" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
DDC9FDB21981B4DD009612C7 /* Debug */, EEBCC9E919CC627E0083B827 /* Debug */,
DDC9FDB31981B4DD009612C7 /* Release */, EEBCC9EA19CC627E0083B827 /* Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
}; };
DDC9FDB41981B4DD009612C7 /* Build configuration list for PBXNativeTarget "SnappyTests" */ = { EEBCC9EB19CC627E0083B827 /* Build configuration list for PBXNativeTarget "SnappyTests" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
DDC9FDB51981B4DD009612C7 /* Debug */, EEBCC9EC19CC627E0083B827 /* Debug */,
DDC9FDB61981B4DD009612C7 /* Release */, EEBCC9ED19CC627E0083B827 /* Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };

View File

@ -1,5 +1,4 @@
// //
// Constraint.swift
// Snappy // Snappy
// //
// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry // Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry
@ -28,280 +27,164 @@ import UIKit
import AppKit import AppKit
#endif #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<NSLayoutAttribute> {
var attrs: Array<NSLayoutAttribute> = []
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 * Constraint is a single item that defines all the properties for a single ConstraintMaker chain
*/ */
class Constraint { public class Constraint {
var left: Constraint { return addConstraint(ConstraintAttributes.Left) } public var left: Constraint { return addConstraint(ConstraintAttributes.Left) }
var top: Constraint { return addConstraint(ConstraintAttributes.Top) } public var top: Constraint { return addConstraint(ConstraintAttributes.Top) }
var right: Constraint { return addConstraint(ConstraintAttributes.Right) } public var right: Constraint { return addConstraint(ConstraintAttributes.Right) }
var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) } public var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) }
var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) } public var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) }
var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) } public var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) }
var width: Constraint { return addConstraint(ConstraintAttributes.Width) } public var width: Constraint { return addConstraint(ConstraintAttributes.Width) }
var height: Constraint { return addConstraint(ConstraintAttributes.Height) } public var height: Constraint { return addConstraint(ConstraintAttributes.Height) }
var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) } public var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) }
var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) } public var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) }
var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) } public var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) }
var and: Constraint { return self } public var and: Constraint { return self }
var with: Constraint { return self } public var with: Constraint { return self }
// MARK: initializer // MARK: initializer
init(fromItem: ConstraintItem) { internal init(fromItem: ConstraintItem) {
self.fromItem = fromItem self.fromItem = fromItem
self.toItem = ConstraintItem(view: nil, attributes: ConstraintAttributes.None) self.toItem = ConstraintItem(view: nil, attributes: ConstraintAttributes.None)
} }
// MARK: equalTo // MARK: equalTo
func equalTo(other: ConstraintItem) -> Constraint { public func equalTo(other: ConstraintItem) -> Constraint {
return constrainTo(other, relation: .Equal) return constrainTo(other, relation: .Equal)
} }
func equalTo(other: View) -> Constraint { public func equalTo(other: View) -> Constraint {
return constrainTo(other, relation: .Equal) return constrainTo(other, relation: .Equal)
} }
func equalTo(other: Float) -> Constraint { public func equalTo(other: Float) -> Constraint {
return constrainTo(other, relation: .Equal) return constrainTo(other, relation: .Equal)
} }
func equalTo(other: Int) -> Constraint { public func equalTo(other: Int) -> Constraint {
return constrainTo(Float(other), relation: .Equal) return constrainTo(Float(other), relation: .Equal)
} }
func equalTo(other: CGSize) -> Constraint { public func equalTo(other: CGSize) -> Constraint {
return constrainTo(other, relation: .Equal) return constrainTo(other, relation: .Equal)
} }
func equalTo(other: CGPoint) -> Constraint { public func equalTo(other: CGPoint) -> Constraint {
return constrainTo(other, relation: .Equal) return constrainTo(other, relation: .Equal)
} }
func equalTo(other: EdgeInsets) -> Constraint { public func equalTo(other: EdgeInsets) -> Constraint {
return constrainTo(other, relation: .Equal) return constrainTo(other, relation: .Equal)
} }
// MARK: lessThanOrEqualTo // MARK: lessThanOrEqualTo
func lessThanOrEqualTo(other: ConstraintItem) -> Constraint { public func lessThanOrEqualTo(other: ConstraintItem) -> Constraint {
return constrainTo(other, relation: .LessThanOrEqualTo) return constrainTo(other, relation: .LessThanOrEqualTo)
} }
func lessThanOrEqualTo(other: View) -> Constraint { public func lessThanOrEqualTo(other: View) -> Constraint {
return constrainTo(other, relation: .LessThanOrEqualTo) return constrainTo(other, relation: .LessThanOrEqualTo)
} }
func lessThanOrEqualTo(other: Float) -> Constraint { public func lessThanOrEqualTo(other: Float) -> Constraint {
return constrainTo(other, relation: .LessThanOrEqualTo) return constrainTo(other, relation: .LessThanOrEqualTo)
} }
func lessThanOrEqualTo(other: Int) -> Constraint { public func lessThanOrEqualTo(other: Int) -> Constraint {
return constrainTo(Float(other), relation: .LessThanOrEqualTo) return constrainTo(Float(other), relation: .LessThanOrEqualTo)
} }
func lessThanOrEqualTo(other: CGSize) -> Constraint { public func lessThanOrEqualTo(other: CGSize) -> Constraint {
return constrainTo(other, relation: .LessThanOrEqualTo) return constrainTo(other, relation: .LessThanOrEqualTo)
} }
func lessThanOrEqualTo(other: CGPoint) -> Constraint { public func lessThanOrEqualTo(other: CGPoint) -> Constraint {
return constrainTo(other, relation: .LessThanOrEqualTo) return constrainTo(other, relation: .LessThanOrEqualTo)
} }
func lessThanOrEqualTo(other: EdgeInsets) -> Constraint { public func lessThanOrEqualTo(other: EdgeInsets) -> Constraint {
return constrainTo(other, relation: .LessThanOrEqualTo) return constrainTo(other, relation: .LessThanOrEqualTo)
} }
// MARK: greaterThanOrEqualTo // MARK: greaterThanOrEqualTo
func greaterThanOrEqualTo(other: ConstraintItem) -> Constraint { public func greaterThanOrEqualTo(other: ConstraintItem) -> Constraint {
return constrainTo(other, relation: .GreaterThanOrEqualTo) return constrainTo(other, relation: .GreaterThanOrEqualTo)
} }
func greaterThanOrEqualTo(other: View) -> Constraint { func greaterThanOrEqualTo(other: View) -> Constraint {
return constrainTo(other, relation: .GreaterThanOrEqualTo) return constrainTo(other, relation: .GreaterThanOrEqualTo)
} }
func greaterThanOrEqualTo(other: Float) -> Constraint { public func greaterThanOrEqualTo(other: Float) -> Constraint {
return constrainTo(other, relation: .GreaterThanOrEqualTo) return constrainTo(other, relation: .GreaterThanOrEqualTo)
} }
func greaterThanOrEqualTo(other: Int) -> Constraint { public func greaterThanOrEqualTo(other: Int) -> Constraint {
return constrainTo(Float(other), relation: .GreaterThanOrEqualTo) return constrainTo(Float(other), relation: .GreaterThanOrEqualTo)
} }
func greaterThanOrEqualTo(other: CGSize) -> Constraint { public func greaterThanOrEqualTo(other: CGSize) -> Constraint {
return constrainTo(other, relation: .GreaterThanOrEqualTo) return constrainTo(other, relation: .GreaterThanOrEqualTo)
} }
func greaterThanOrEqualTo(other: CGPoint) -> Constraint { public func greaterThanOrEqualTo(other: CGPoint) -> Constraint {
return constrainTo(other, relation: .GreaterThanOrEqualTo) return constrainTo(other, relation: .GreaterThanOrEqualTo)
} }
func greaterThanOrEqualTo(other: EdgeInsets) -> Constraint { public func greaterThanOrEqualTo(other: EdgeInsets) -> Constraint {
return constrainTo(other, relation: .GreaterThanOrEqualTo) return constrainTo(other, relation: .GreaterThanOrEqualTo)
} }
// MARK: multiplier // MARK: multiplier
func multipliedBy(amount: Float) -> Constraint { public func multipliedBy(amount: Float) -> Constraint {
self.multiplier = amount self.multiplier = amount
return self return self
} }
func dividedBy(amount: Float) -> Constraint { public func dividedBy(amount: Float) -> Constraint {
self.multiplier = 1.0 / amount; self.multiplier = 1.0 / amount;
return self return self
} }
// MARK: priority // MARK: priority
func priority(priority: Float) -> Constraint { public func priority(priority: Float) -> Constraint {
self.priority = priority self.priority = priority
return self return self
} }
func priorityRequired() -> Constraint { public func priorityRequired() -> Constraint {
return priority(1000.0) return priority(1000.0)
} }
func priorityHigh() -> Constraint { public func priorityHigh() -> Constraint {
return priority(750.0) return priority(750.0)
} }
func priorityLow() -> Constraint { public func priorityLow() -> Constraint {
return priority(250.0) return priority(250.0)
} }
// MARK: offset // MARK: offset
func offset(amount: Float) -> Constraint { public func offset(amount: Float) -> Constraint {
self.offset = amount self.offset = amount
return self return self
} }
func offset(amount: Int) -> Constraint { public func offset(amount: Int) -> Constraint {
self.offset = amount self.offset = amount
return self return self
} }
func offset(amount: CGPoint) -> Constraint { public func offset(amount: CGPoint) -> Constraint {
self.offset = amount self.offset = amount
return self return self
} }
func offset(amount: CGSize) -> Constraint { public func offset(amount: CGSize) -> Constraint {
self.offset = amount self.offset = amount
return self return self
} }
func offset(amount: EdgeInsets) -> Constraint { public func offset(amount: EdgeInsets) -> Constraint {
self.offset = amount self.offset = amount
return self return self
} }
// MARK: insets // MARK: insets
func insets(amount: EdgeInsets) -> Constraint { public func insets(amount: EdgeInsets) -> Constraint {
self.offset = amount self.offset = amount
return self return self
} }
// MARK: install // MARK: install
func install() -> Array<LayoutConstraint> { public func install() -> Array<LayoutConstraint> {
var installOnView: View? = nil var installOnView: View? = nil
if self.toItem.view != nil { if self.toItem.view != nil {
installOnView = Constraint.closestCommonSuperviewFromView(self.fromItem.view, toView: self.toItem.view) installOnView = Constraint.closestCommonSuperviewFromView(self.fromItem.view, toView: self.toItem.view)
@ -343,7 +226,7 @@ class Constraint {
// create layout constraint // create layout constraint
let layoutConstraint = LayoutConstraint( let layoutConstraint = LayoutConstraint(
item: layoutFrom, item: layoutFrom!,
attribute: layoutFromAttribute, attribute: layoutFromAttribute,
relatedBy: layoutRelation, relatedBy: layoutRelation,
toItem: layoutTo, toItem: layoutTo,
@ -368,7 +251,7 @@ class Constraint {
// MARK: uninstall // MARK: uninstall
func uninstall() { public func uninstall() {
if let view = self.installedOnView { if let view = self.installedOnView {
#if os(iOS) #if os(iOS)
var installedConstraints = view.constraints() var installedConstraints = view.constraints()
@ -464,7 +347,7 @@ class Constraint {
private extension NSLayoutAttribute { private extension NSLayoutAttribute {
func snp_offsetForValue(value: Any?) -> CGFloat { private func snp_offsetForValue(value: Any?) -> CGFloat {
// Float // Float
if let float = value as? Float { if let float = value as? Float {
return CGFloat(float) return CGFloat(float)
@ -513,7 +396,7 @@ private extension NSLayoutAttribute {
return CGFloat(0) return CGFloat(0)
} }
func snp_constantForValue(value: Any?) -> CGFloat { private func snp_constantForValue(value: Any?) -> CGFloat {
// Float // Float
if let float = value as? Float { if let float = value as? Float {
return CGFloat(float) return CGFloat(float)

View File

@ -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<NSLayoutAttribute> {
var attrs: Array<NSLayoutAttribute> = []
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
}

View File

@ -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
}

View File

@ -1,5 +1,4 @@
// //
// ConstraintMaker.swift
// Snappy // Snappy
// //
// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry // 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 * ConstraintMaker is the maker in snappy that gets all constraints kickstarted
*/ */
class ConstraintMaker { public class ConstraintMaker {
var left: Constraint { return addConstraint(ConstraintAttributes.Left) } public var left: Constraint { return addConstraint(ConstraintAttributes.Left) }
var top: Constraint { return addConstraint(ConstraintAttributes.Top) } public var top: Constraint { return addConstraint(ConstraintAttributes.Top) }
var right: Constraint { return addConstraint(ConstraintAttributes.Right) } public var right: Constraint { return addConstraint(ConstraintAttributes.Right) }
var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) } public var bottom: Constraint { return addConstraint(ConstraintAttributes.Bottom) }
var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) } public var leading: Constraint { return addConstraint(ConstraintAttributes.Leading) }
var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) } public var trailing: Constraint { return addConstraint(ConstraintAttributes.Trailing) }
var width: Constraint { return addConstraint(ConstraintAttributes.Width) } public var width: Constraint { return addConstraint(ConstraintAttributes.Width) }
var height: Constraint { return addConstraint(ConstraintAttributes.Height) } public var height: Constraint { return addConstraint(ConstraintAttributes.Height) }
var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) } public var centerX: Constraint { return addConstraint(ConstraintAttributes.CenterX) }
var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) } public var centerY: Constraint { return addConstraint(ConstraintAttributes.CenterY) }
var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) } public var baseline: Constraint { return addConstraint(ConstraintAttributes.Baseline) }
var edges: Constraint { return addConstraint(ConstraintAttributes.Edges) } public var edges: Constraint { return addConstraint(ConstraintAttributes.Edges) }
var size: Constraint { return addConstraint(ConstraintAttributes.Size) } public var size: Constraint { return addConstraint(ConstraintAttributes.Size) }
var center: Constraint { return addConstraint(ConstraintAttributes.Center) } public var center: Constraint { return addConstraint(ConstraintAttributes.Center) }
init(view: View) { init(view: View) {
self.view = view self.view = view
@ -99,4 +98,3 @@ class ConstraintMaker {
LayoutConstraint.setLayoutConstraints(layoutConstraints, installedOnView: view) LayoutConstraint.setLayoutConstraints(layoutConstraints, installedOnView: view)
} }
} }

View File

@ -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
}
}
}
}

View File

@ -1,5 +1,4 @@
// //
// Insets.swift
// Snappy // Snappy
// //
// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry // 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 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) #if os(iOS)
import UIKit import UIKit
typealias EdgeInsets = UIEdgeInsets public typealias EdgeInsets = UIEdgeInsets
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) 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 #else
import AppKit import AppKit
struct EdgeInsets { public struct EdgeInsets {
var top: CGFloat // specify amount to inset (positive) for each of the edges. values can be negative to 'outset' public var top: CGFloat // specify amount to inset (positive) for each of the edges. values can be negative to 'outset'
var left: CGFloat public var left: CGFloat
var bottom: CGFloat public var bottom: CGFloat
var right: 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) 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 #endif

26
Snappy/Info.plist Normal file
View File

@ -0,0 +1,26 @@
<?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.masonry.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,5 +1,4 @@
// //
// LayoutConstraint.swift
// Snappy // Snappy
// //
// Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry // Copyright (c) 2011-2014 Masonry Team - https://github.com/Masonry
@ -31,7 +30,7 @@ import AppKit
/** /**
* LayoutConstraint is a subclass of NSLayoutConstraint to assist Snappy and also provide better debugging * LayoutConstraint is a subclass of NSLayoutConstraint to assist Snappy and also provide better debugging
*/ */
class LayoutConstraint: NSLayoutConstraint { public class LayoutConstraint: NSLayoutConstraint {
// internal // internal

30
Snappy/Snappy.h Normal file
View File

@ -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 <UIKit/UIKit.h>
//! Project version number for Snappy.
FOUNDATION_EXPORT double SnappyVersionNumber;
//! Project version string for Snappy.
FOUNDATION_EXPORT const unsigned char SnappyVersionString[];

56
Snappy/View+Snappy.swift Normal file
View File

@ -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)
}
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -1,43 +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>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -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)
}
}
}

24
SnappyTests/Info.plist Normal file
View File

@ -0,0 +1,24 @@
<?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.masonry.$(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>

View File

@ -2,7 +2,7 @@
// SnappyTests.swift // SnappyTests.swift
// SnappyTests // 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. // Copyright (c) 2014 Jonas Budelmann. All rights reserved.
// //