Authored by Jonas Budelmann

fixing #define MAS_SHORTHAND

@@ -8,8 +8,6 @@ build/* @@ -8,8 +8,6 @@ build/*
8 !default.mode2v3 8 !default.mode2v3
9 *.perspectivev3 9 *.perspectivev3
10 !default.perspectivev3 10 !default.perspectivev3
11 -*.xcworkspace  
12 -!default.xcworkspace  
13 xcuserdata 11 xcuserdata
14 profile 12 profile
15 *.moved-aside 13 *.moved-aside
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
27 DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; }; 27 DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };
28 DD52F269179CB34A005CD195 /* MASViewConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; }; 28 DD52F269179CB34A005CD195 /* MASViewConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
29 DD52F26A179CB365005CD195 /* MASCompositeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1DC179CAACA005CD195 /* MASCompositeConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29 DD52F26A179CB365005CD195 /* MASCompositeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1DC179CAACA005CD195 /* MASCompositeConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
  30 + DDE2653F179D24E600D48565 /* UIView+MASShorthandAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
30 F0D61B353FCC42358F962A3C /* libPods-MasonryTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */; }; 31 F0D61B353FCC42358F962A3C /* libPods-MasonryTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */; };
31 /* End PBXBuildFile section */ 32 /* End PBXBuildFile section */
32 33
@@ -77,6 +78,7 @@ @@ -77,6 +78,7 @@
77 DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASAdditions.h"; sourceTree = "<group>"; }; 78 DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASAdditions.h"; sourceTree = "<group>"; };
78 DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MASAdditions.m"; sourceTree = "<group>"; }; 79 DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MASAdditions.m"; sourceTree = "<group>"; };
79 DD52F1ED179CAAEE005CD195 /* Masonry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Masonry.h; sourceTree = "<group>"; }; 80 DD52F1ED179CAAEE005CD195 /* Masonry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Masonry.h; sourceTree = "<group>"; };
  81 + DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASShorthandAdditions.h"; sourceTree = "<group>"; };
80 DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MasonryTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 82 DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MasonryTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81 /* End PBXFileReference section */ 83 /* End PBXFileReference section */
82 84
@@ -187,6 +189,7 @@ @@ -187,6 +189,7 @@
187 children = ( 189 children = (
188 DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */, 190 DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */,
189 DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */, 191 DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */,
  192 + DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */,
190 ); 193 );
191 name = Additions; 194 name = Additions;
192 sourceTree = "<group>"; 195 sourceTree = "<group>";
@@ -216,6 +219,7 @@ @@ -216,6 +219,7 @@
216 files = ( 219 files = (
217 DD52F264179CB327005CD195 /* Masonry.h in Headers */, 220 DD52F264179CB327005CD195 /* Masonry.h in Headers */,
218 DD52F265179CB32B005CD195 /* UIView+MASAdditions.h in Headers */, 221 DD52F265179CB32B005CD195 /* UIView+MASAdditions.h in Headers */,
  222 + DDE2653F179D24E600D48565 /* UIView+MASShorthandAdditions.h in Headers */,
219 DD52F266179CB33F005CD195 /* MASConstraint.h in Headers */, 223 DD52F266179CB33F005CD195 /* MASConstraint.h in Headers */,
220 DD52F267179CB342005CD195 /* MASConstraintBuilder.h in Headers */, 224 DD52F267179CB342005CD195 /* MASConstraintBuilder.h in Headers */,
221 DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */, 225 DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */,
@@ -459,12 +463,10 @@ @@ -459,12 +463,10 @@
459 DSTROOT = /tmp/Masonry.dst; 463 DSTROOT = /tmp/Masonry.dst;
460 GCC_PRECOMPILE_PREFIX_HEADER = YES; 464 GCC_PRECOMPILE_PREFIX_HEADER = YES;
461 GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch"; 465 GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
462 - OTHER_LDFLAGS = (  
463 - "-ObjC",  
464 - "-all_load",  
465 - ); 466 + OTHER_LDFLAGS = "-ObjC";
466 PRODUCT_NAME = "$(TARGET_NAME)"; 467 PRODUCT_NAME = "$(TARGET_NAME)";
467 SKIP_INSTALL = YES; 468 SKIP_INSTALL = YES;
  469 + VALID_ARCHS = "armv7 armv7s i386 x86_64";
468 }; 470 };
469 name = Debug; 471 name = Debug;
470 }; 472 };
@@ -474,12 +476,10 @@ @@ -474,12 +476,10 @@
474 DSTROOT = /tmp/Masonry.dst; 476 DSTROOT = /tmp/Masonry.dst;
475 GCC_PRECOMPILE_PREFIX_HEADER = YES; 477 GCC_PRECOMPILE_PREFIX_HEADER = YES;
476 GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch"; 478 GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
477 - OTHER_LDFLAGS = (  
478 - "-ObjC",  
479 - "-all_load",  
480 - ); 479 + OTHER_LDFLAGS = "-ObjC";
481 PRODUCT_NAME = "$(TARGET_NAME)"; 480 PRODUCT_NAME = "$(TARGET_NAME)";
482 SKIP_INSTALL = YES; 481 SKIP_INSTALL = YES;
  482 + VALID_ARCHS = "armv7 armv7s i386 x86_64";
483 }; 483 };
484 name = Release; 484 name = Release;
485 }; 485 };
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "self:Masonry.xcodeproj">
  6 + </FileRef>
  7 +</Workspace>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "group:Masonry.xcodeproj">
  6 + </FileRef>
  7 + <FileRef
  8 + location = "group:MasonryExamples/MasonryExamples.xcodeproj">
  9 + </FileRef>
  10 + <FileRef
  11 + location = "group:Pods/Pods.xcodeproj">
  12 + </FileRef>
  13 +</Workspace>
@@ -10,15 +10,15 @@ @@ -10,15 +10,15 @@
10 10
11 @protocol MASConstraint <NSObject> 11 @protocol MASConstraint <NSObject>
12 12
13 -@property (nonatomic, strong, readonly) id<MASConstraint> (^insets)(UIEdgeInsets insets);  
14 -@property (nonatomic, strong, readonly) id<MASConstraint> (^sizeOffset)(CGSize offset);  
15 -@property (nonatomic, strong, readonly) id<MASConstraint> (^centerOffset)(CGPoint offset);  
16 -@property (nonatomic, strong, readonly) id<MASConstraint> (^offset)(CGFloat offset);  
17 -@property (nonatomic, strong, readonly) id<MASConstraint> (^percent)(CGFloat percent);  
18 -@property (nonatomic, strong, readonly) id<MASConstraint> (^priority)(UILayoutPriority priority);  
19 -@property (nonatomic, strong, readonly) id<MASConstraint> (^equal)(id attr);  
20 -@property (nonatomic, strong, readonly) id<MASConstraint> (^greaterThanOrEqual)(id attr);  
21 -@property (nonatomic, strong, readonly) id<MASConstraint> (^lessThanOrEqual)(id attr); 13 +@property (nonatomic, copy, readonly) id<MASConstraint> (^insets)(UIEdgeInsets insets);
  14 +@property (nonatomic, copy, readonly) id<MASConstraint> (^sizeOffset)(CGSize offset);
  15 +@property (nonatomic, copy, readonly) id<MASConstraint> (^centerOffset)(CGPoint offset);
  16 +@property (nonatomic, copy, readonly) id<MASConstraint> (^offset)(CGFloat offset);
  17 +@property (nonatomic, copy, readonly) id<MASConstraint> (^percent)(CGFloat percent);
  18 +@property (nonatomic, copy, readonly) id<MASConstraint> (^priority)(UILayoutPriority priority);
  19 +@property (nonatomic, copy, readonly) id<MASConstraint> (^equal)(id attr);
  20 +@property (nonatomic, copy, readonly) id<MASConstraint> (^greaterThanOrEqual)(id attr);
  21 +@property (nonatomic, copy, readonly) id<MASConstraint> (^lessThanOrEqual)(id attr);
22 22
23 - (void)commit; 23 - (void)commit;
24 24
@@ -7,5 +7,9 @@ @@ -7,5 +7,9 @@
7 // 7 //
8 8
9 #import "UIView+MASAdditions.h" 9 #import "UIView+MASAdditions.h"
  10 +#import "UIView+MASShorthandAdditions.h"
  11 +#import "MASConstraint.h"
  12 +#import "MASCompositeConstraint.h"
  13 +#import "MASViewAttribute.h"
10 #import "MASViewConstraint.h" 14 #import "MASViewConstraint.h"
11 #import "MASConstraintBuilder.h" 15 #import "MASConstraintBuilder.h"
@@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
10 #import "MASConstraintBuilder.h" 10 #import "MASConstraintBuilder.h"
11 #import "MASViewAttribute.h" 11 #import "MASViewAttribute.h"
12 12
13 -  
14 @interface UIView (MASAdditions) 13 @interface UIView (MASAdditions)
15 14
16 @property (nonatomic, strong, readonly) MASViewAttribute *mas_left; 15 @property (nonatomic, strong, readonly) MASViewAttribute *mas_left;
@@ -27,26 +26,4 @@ @@ -27,26 +26,4 @@
27 26
28 - (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constraints))block; 27 - (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
29 28
30 -@end  
31 -  
32 -#ifdef MAS_SHORTHAND  
33 -  
34 -@interface UIView (MASShortHandAdditions)  
35 -  
36 -@property (nonatomic, strong, readonly) MASViewAttribute *left;  
37 -@property (nonatomic, strong, readonly) MASViewAttribute *top;  
38 -@property (nonatomic, strong, readonly) MASViewAttribute *right;  
39 -@property (nonatomic, strong, readonly) MASViewAttribute *bottom;  
40 -@property (nonatomic, strong, readonly) MASViewAttribute *leading;  
41 -@property (nonatomic, strong, readonly) MASViewAttribute *trailing;  
42 -@property (nonatomic, strong, readonly) MASViewAttribute *width;  
43 -@property (nonatomic, strong, readonly) MASViewAttribute *height;  
44 -@property (nonatomic, strong, readonly) MASViewAttribute *centerX;  
45 -@property (nonatomic, strong, readonly) MASViewAttribute *centerY;  
46 -@property (nonatomic, strong, readonly) MASViewAttribute *baseline;  
47 -  
48 -- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;  
49 -  
50 -@end  
51 -  
52 -#endif  
  29 +@end
@@ -63,29 +63,4 @@ @@ -63,29 +63,4 @@
63 return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline]; 63 return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline];
64 } 64 }
65 65
66 -@end  
67 -  
68 -#define MAS_ATTR_FORWARD(attr) \  
69 -- (MASViewAttribute *)attr { \  
70 - return [self mas_##attr]; \  
71 -}  
72 -  
73 -@implementation UIView (MASShortHandAdditions)  
74 -  
75 -MAS_ATTR_FORWARD(top);  
76 -MAS_ATTR_FORWARD(left);  
77 -MAS_ATTR_FORWARD(bottom);  
78 -MAS_ATTR_FORWARD(right);  
79 -MAS_ATTR_FORWARD(leading);  
80 -MAS_ATTR_FORWARD(trailing);  
81 -MAS_ATTR_FORWARD(width);  
82 -MAS_ATTR_FORWARD(height);  
83 -MAS_ATTR_FORWARD(centerX);  
84 -MAS_ATTR_FORWARD(centerY);  
85 -MAS_ATTR_FORWARD(baseline);  
86 -  
87 -- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block {  
88 - [self mas_buildConstraints:block];  
89 -}  
90 -  
91 -@end 66 +@end
  1 +//
  2 +// UIView+MASShorthandAdditions.h
  3 +// Masonry
  4 +//
  5 +// Created by Jonas Budelmann on 22/07/13.
  6 +// Copyright (c) 2013 Jonas Budelmann. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +#import "UIView+MASAdditions.h"
  11 +
  12 +#ifdef MAS_SHORTHAND
  13 +
  14 +@interface UIView (MASShorthandAdditions)
  15 +
  16 +@property (nonatomic, strong, readonly) MASViewAttribute *left;
  17 +@property (nonatomic, strong, readonly) MASViewAttribute *top;
  18 +@property (nonatomic, strong, readonly) MASViewAttribute *right;
  19 +@property (nonatomic, strong, readonly) MASViewAttribute *bottom;
  20 +@property (nonatomic, strong, readonly) MASViewAttribute *leading;
  21 +@property (nonatomic, strong, readonly) MASViewAttribute *trailing;
  22 +@property (nonatomic, strong, readonly) MASViewAttribute *width;
  23 +@property (nonatomic, strong, readonly) MASViewAttribute *height;
  24 +@property (nonatomic, strong, readonly) MASViewAttribute *centerX;
  25 +@property (nonatomic, strong, readonly) MASViewAttribute *centerY;
  26 +@property (nonatomic, strong, readonly) MASViewAttribute *baseline;
  27 +
  28 +- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
  29 +
  30 +@end
  31 +
  32 +#define MAS_ATTR_FORWARD(attr) \
  33 +- (MASViewAttribute *)attr { \
  34 + return [self mas_##attr]; \
  35 +}
  36 +
  37 +@implementation UIView (MASShorthandAdditions)
  38 +
  39 +MAS_ATTR_FORWARD(top);
  40 +MAS_ATTR_FORWARD(left);
  41 +MAS_ATTR_FORWARD(bottom);
  42 +MAS_ATTR_FORWARD(right);
  43 +MAS_ATTR_FORWARD(leading);
  44 +MAS_ATTR_FORWARD(trailing);
  45 +MAS_ATTR_FORWARD(width);
  46 +MAS_ATTR_FORWARD(height);
  47 +MAS_ATTR_FORWARD(centerX);
  48 +MAS_ATTR_FORWARD(centerY);
  49 +MAS_ATTR_FORWARD(baseline);
  50 +
  51 +- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block {
  52 + [self mas_buildConstraints:block];
  53 +}
  54 +
  55 +@end
  56 +
  57 +#endif
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "self:MasonryExamples.xcodeproj">
  6 + </FileRef>
  7 +</Workspace>