Jonas Budelmann 12 лет назад
Родитель
Сommit
16164cba12

+ 4 - 4
Masonry.podspec

@@ -1,12 +1,12 @@
 Pod::Spec.new do |s|
   s.name     = 'Masonry'
-  s.version  = '0.2.1'
+  s.version  = '0.2.2'
   s.license  = 'MIT'
   s.summary  = 'Harness the power of Auto Layout NSLayoutConstraints with a simplified, chainable and expressive syntax.'
   s.homepage = 'https://github.com/cloudkite/Masonry'
   s.author   = { 'Jonas Budelmann' => 'jonas.budelmann@gmail.com' }
 
-  s.source   = { :git => 'https://github.com/cloudkite/Masonry.git', :tag => 'v0.2.1' }
+  s.source   = { :git => 'https://github.com/cloudkite/Masonry.git', :tag => 'v0.2.2' }
 
   s.description = %{
     Masonary is a light-weight layout framework which wraps AutoLayout with a nicer syntax.
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
   s.ios.frameworks = 'Foundation', 'UIKit'
   s.osx.frameworks = 'Foundation', 'AppKit'
 
-  s.ios.deployment_target = '6.0' # using autolayout
-  s.osx.deployment_target = '10.8' # should change to 10.7
+  s.ios.deployment_target = '6.0' # minimum SDK with autolayout
+  s.osx.deployment_target = '10.7' # minimum SDK with autolayout
   s.requires_arc = true
 end

+ 12 - 10
Masonry.xcodeproj/project.pbxproj

@@ -34,7 +34,6 @@
 		DD7CC16F17ACCF22007A469E /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7CC16D17ACCF22007A469E /* NSLayoutConstraint+MASDebugAdditions.m */; };
 		DD93AAF317ACB647008F7D21 /* MASLayoutConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD93AAF117ACB647008F7D21 /* MASLayoutConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DD93AAF417ACB647008F7D21 /* MASLayoutConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = DD93AAF217ACB647008F7D21 /* MASLayoutConstraint.m */; };
-		DDA4D6ED17C0253B0076BD87 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA4D6EC17C0253B0076BD87 /* Cocoa.framework */; };
 		DDA4D70217C0253B0076BD87 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD52F1BC179CA93B005CD195 /* SenTestingKit.framework */; };
 		DDA4D70317C0253B0076BD87 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA4D6EC17C0253B0076BD87 /* Cocoa.framework */; };
 		DDA4D70617C0253B0076BD87 /* Masonry Mac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA4D6EB17C0253B0076BD87 /* Masonry Mac.framework */; };
@@ -61,6 +60,7 @@
 		DDA5752B17C17C3E0010F88E /* MASUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = DDA5752917C17C3E0010F88E /* MASUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DDA5752D17C187D40010F88E /* MASUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = DDA5752917C17C3E0010F88E /* MASUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DDE2653F179D24E600D48565 /* View+MASShorthandAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DDE2653D179D24E600D48565 /* View+MASShorthandAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DDEDACEF17C845DE00098BE6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDEDACEE17C845DE00098BE6 /* Cocoa.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -133,6 +133,7 @@
 		DDA4D70117C0253B0076BD87 /* Masonry Mac Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Masonry Mac Tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
 		DDA5752917C17C3E0010F88E /* MASUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASUtilities.h; sourceTree = "<group>"; };
 		DDE2653D179D24E600D48565 /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASShorthandAdditions.h"; sourceTree = "<group>"; };
+		DDEDACEE17C845DE00098BE6 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
 		EDE028375B0043E190A00F61 /* Pods-Masonry Mac Tests.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Masonry Mac Tests.xcconfig"; path = "Pods/Pods-Masonry Mac Tests.xcconfig"; sourceTree = SOURCE_ROOT; };
 /* End PBXFileReference section */
 
@@ -161,7 +162,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				DDA4D6ED17C0253B0076BD87 /* Cocoa.framework in Frameworks */,
+				DDEDACEF17C845DE00098BE6 /* Cocoa.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -205,6 +206,7 @@
 		DD52F1AC179CA93B005CD195 /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				DDEDACEE17C845DE00098BE6 /* Cocoa.framework */,
 				DD52F1AD179CA93B005CD195 /* Foundation.framework */,
 				DD52F1BC179CA93B005CD195 /* SenTestingKit.framework */,
 				DD52F1BE179CA93B005CD195 /* UIKit.framework */,
@@ -781,10 +783,10 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.8;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx10.8;
+				SDKROOT = macosx10.7;
 				VALID_ARCHS = "x86_64 i386";
 				WRAPPER_EXTENSION = framework;
 			};
@@ -807,10 +809,10 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.8;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx10.8;
+				SDKROOT = macosx10.7;
 				VALID_ARCHS = "x86_64 i386";
 				WRAPPER_EXTENSION = framework;
 			};
@@ -831,10 +833,10 @@
 				GCC_PREFIX_HEADER = "MasonryTests/MasonryTests-Prefix.pch";
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				INFOPLIST_FILE = "MasonryTests/MasonryTests-Info.plist";
-				MACOSX_DEPLOYMENT_TARGET = 10.8;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx10.8;
+				SDKROOT = macosx10.7;
 				VALID_ARCHS = "x86_64 i386";
 				WRAPPER_EXTENSION = octest;
 			};
@@ -856,10 +858,10 @@
 				GCC_PREFIX_HEADER = "MasonryTests/MasonryTests-Prefix.pch";
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				INFOPLIST_FILE = "MasonryTests/MasonryTests-Info.plist";
-				MACOSX_DEPLOYMENT_TARGET = 10.8;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = NO;
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx10.8;
+				SDKROOT = macosx10.7;
 				VALID_ARCHS = "x86_64 i386";
 				WRAPPER_EXTENSION = octest;
 			};

+ 2 - 2
Masonry/MASCompositeConstraint.h

@@ -9,12 +9,12 @@
 #import "MASConstraint.h"
 #import "MASUtilities.h"
 
-typedef NS_ENUM(NSInteger, MASCompositeConstraintType) {
+typedef enum MASCompositeConstraintType : NSInteger {
     MASCompositeConstraintTypeEdges, //top, left, bottom, right
     MASCompositeConstraintTypeSize, //width, height
     MASCompositeConstraintTypeCenter, //centerX, centerY
     MASCompositeConstraintTypeUnknown, //could be mixture of any attributes
-};
+} MASCompositeConstraintType;
 
 /**
  *	A group of MASConstraint objects

+ 4 - 4
Masonry/NSLayoutConstraint+MASDebugAdditions.m

@@ -94,16 +94,16 @@
 
     [description appendFormat:@" %@", [self.class descriptionForObject:self.firstItem]];
     if (self.firstAttribute != NSLayoutAttributeNotAnAttribute) {
-        [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.firstAttribute)]];
+        [description appendFormat:@".%@", [self.class.layoutAttributeDescriptionsByValue objectForKey:@(self.firstAttribute)]];
     }
 
-    [description appendFormat:@" %@", self.class.layoutRelationDescriptionsByValue[@(self.relation)]];
+    [description appendFormat:@" %@", [self.class.layoutRelationDescriptionsByValue objectForKey:@(self.relation)]];
 
     if (self.secondItem) {
         [description appendFormat:@" %@", [self.class descriptionForObject:self.secondItem]];
     }
     if (self.secondAttribute != NSLayoutAttributeNotAnAttribute) {
-        [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.secondAttribute)]];
+        [description appendFormat:@".%@", [self.class.layoutAttributeDescriptionsByValue objectForKey:@(self.secondAttribute)]];
     }
     
     if (self.multiplier != 1) {
@@ -119,7 +119,7 @@
     }
 
     if (self.priority != MASLayoutPriorityRequired) {
-        [description appendFormat:@" ^%@", self.class.layoutPriorityDescriptionsByValue[@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]];
+        [description appendFormat:@" ^%@", [self.class.layoutPriorityDescriptionsByValue objectForKey:@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]];
     }
 
     [description appendString:@">"];

+ 12 - 12
MasonryTests/MASCompositeConstraintSpec.m

@@ -43,11 +43,11 @@ it(@"should create centerY and centerX children", ^{
 
     expect(composite.childConstraints).to.haveCountOf(2);
 
-    MASViewConstraint *viewConstraint = composite.childConstraints[0];
+    MASViewConstraint *viewConstraint = [composite.childConstraints objectAtIndex:0];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeCenterX);
 
-    viewConstraint = composite.childConstraints[1];
+    viewConstraint = [composite.childConstraints objectAtIndex:1];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeCenterY);
 });
@@ -60,22 +60,22 @@ it(@"should create top, left, bottom, right children", ^{
     expect(composite.childConstraints).to.haveCountOf(4);
 
     //top
-    MASViewConstraint *viewConstraint = composite.childConstraints[0];
+    MASViewConstraint *viewConstraint = [composite.childConstraints objectAtIndex:0];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeTop);
 
     //left
-    viewConstraint = composite.childConstraints[1];
+    viewConstraint = [composite.childConstraints objectAtIndex:1];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeLeft);
 
     //bottom
-    viewConstraint = composite.childConstraints[2];
+    viewConstraint = [composite.childConstraints objectAtIndex:2];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeBottom);
 
     //right
-    viewConstraint = composite.childConstraints[3];
+    viewConstraint = [composite.childConstraints objectAtIndex:3];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeRight);
 });
@@ -84,11 +84,11 @@ it(@"should create width and height children", ^{
     composite = [[MASCompositeConstraint alloc] initWithView:view type:MASCompositeConstraintTypeSize];
     expect(composite.childConstraints).to.haveCountOf(2);
 
-    MASViewConstraint *viewConstraint = composite.childConstraints[0];
+    MASViewConstraint *viewConstraint = [composite.childConstraints objectAtIndex:0];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeWidth);
 
-    viewConstraint = composite.childConstraints[1];
+    viewConstraint = [composite.childConstraints objectAtIndex:1];
     expect(viewConstraint.firstViewAttribute.view).to.beIdenticalTo(composite.view);
     expect(viewConstraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeHeight);
 });
@@ -103,13 +103,13 @@ it(@"should complete children", ^{
     
     expect(composite.childConstraints).to.haveCountOf(2);
 
-    MASViewConstraint *viewConstraint = composite.childConstraints[0];
+    MASViewConstraint *viewConstraint = [composite.childConstraints objectAtIndex:0];
     expect(viewConstraint.secondViewAttribute.view).to.beIdenticalTo(newView);
     expect(viewConstraint.secondViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeWidth);
     expect(viewConstraint.layoutConstant).to.equal(90);
     expect(viewConstraint.layoutPriority).to.equal(MASLayoutPriorityDefaultLow);
 
-    viewConstraint = composite.childConstraints[1];
+    viewConstraint = [composite.childConstraints objectAtIndex:1];
     expect(viewConstraint.secondViewAttribute.view).to.beIdenticalTo(newView);
     expect(viewConstraint.secondViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeHeight);
     expect(viewConstraint.layoutConstant).to.equal(30);
@@ -139,8 +139,8 @@ it(@"should spawn child composite constraints", ^{
     composite.lessThanOrEqualTo(@[@2, otherView]);
 
     expect(composite.childConstraints).to.haveCountOf(2);
-    expect(composite.childConstraints[0]).to.beKindOf(MASCompositeConstraint.class);
-    expect(composite.childConstraints[1]).to.beKindOf(MASCompositeConstraint.class);
+    expect([composite.childConstraints objectAtIndex:0]).to.beKindOf(MASCompositeConstraint.class);
+    expect([composite.childConstraints objectAtIndex:1]).to.beKindOf(MASCompositeConstraint.class);
 });
 
 SpecEnd

+ 7 - 7
MasonryTests/MASViewConstraintSpec.m

@@ -121,10 +121,10 @@ describe(@"create equality constraint", ^{
         MASCompositeConstraint *composite = (id)constraint.equalTo(views).priorityMedium().offset(-10);
 
         expect(delegate.constraints).to.haveCountOf(1);
-        expect(delegate.constraints[0]).to.beKindOf(MASCompositeConstraint.class);
+        expect([delegate.constraints objectAtIndex:0]).to.beKindOf(MASCompositeConstraint.class);
         for (MASViewConstraint *constraint in composite.childConstraints) {
             NSUInteger index = [composite.childConstraints indexOfObject:constraint];
-            expect(constraint.secondViewAttribute.view).to.beIdenticalTo(views[index]);
+            expect(constraint.secondViewAttribute.view).to.beIdenticalTo((MAS_VIEW *)[views objectAtIndex:index]);
             expect(constraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeWidth);
             expect(constraint.secondViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeWidth);
             expect(constraint.layoutPriority).to.equal(MASLayoutPriorityDefaultMedium);
@@ -139,12 +139,12 @@ describe(@"create equality constraint", ^{
         MASCompositeConstraint *composite = (id)constraint.equalTo(viewAttributes).priority(60).offset(10);
 
         expect(delegate.constraints).to.haveCountOf(1);
-        expect(delegate.constraints[0]).to.beKindOf(MASCompositeConstraint.class);
+        expect([delegate.constraints objectAtIndex:0]).to.beKindOf(MASCompositeConstraint.class);
         for (MASViewConstraint *constraint in composite.childConstraints) {
             NSUInteger index = [composite.childConstraints indexOfObject:constraint];
-            expect(constraint.secondViewAttribute.view).to.beIdenticalTo([viewAttributes[index] view]);
+            expect(constraint.secondViewAttribute.view).to.beIdenticalTo([[viewAttributes objectAtIndex:index] view]);
             expect(constraint.firstViewAttribute.layoutAttribute).to.equal(NSLayoutAttributeWidth);
-            expect(constraint.secondViewAttribute.layoutAttribute).to.equal([viewAttributes[index] layoutAttribute]);
+            expect(constraint.secondViewAttribute.layoutAttribute).to.equal([[viewAttributes objectAtIndex:index] layoutAttribute]);
             expect(constraint.layoutPriority).to.equal(60);
             expect(constraint.layoutConstant).to.equal(10);
         }
@@ -239,7 +239,7 @@ describe(@"install", ^{
         expect(constraint.layoutConstraint.priority).to.equal(345);
         expect(constraint.layoutConstraint.multiplier).to.equal(0.5);
 
-        expect(superview.constraints[0]).to.beIdenticalTo(constraint.layoutConstraint);
+        expect([superview.constraints objectAtIndex:0]).to.beIdenticalTo(constraint.layoutConstraint);
     });
 
     it(@"should uninstall constraint", ^{
@@ -248,7 +248,7 @@ describe(@"install", ^{
         [constraint install];
 
         expect(superview.constraints).to.haveCountOf(1);
-        expect(superview.constraints[0]).to.equal(constraint.layoutConstraint);
+        expect([superview.constraints objectAtIndex:0]).to.equal(constraint.layoutConstraint);
 
         [constraint uninstall];
         expect(superview.constraints).to.haveCountOf(0);

+ 1 - 1
Podfile

@@ -1,5 +1,5 @@
 target 'Masonry Mac Tests', :exclusive => true do
-    platform :osx, '10.8'
+    platform :osx, '10.7'
     pod 'Specta'
 	pod 'Expecta'
 end