Skip to content

Commit b644282

Browse files
committed
fixing #define MAS_SHORTHAND
1 parent 8f2d1b9 commit b644282

File tree

10 files changed

+107
-69
lines changed

10 files changed

+107
-69
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ build/*
88
!default.mode2v3
99
*.perspectivev3
1010
!default.perspectivev3
11-
*.xcworkspace
12-
!default.xcworkspace
1311
xcuserdata
1412
profile
1513
*.moved-aside

Masonry.xcodeproj/project.pbxproj

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };
2828
DD52F269179CB34A005CD195 /* MASViewConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
2929
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, ); }; };
3031
F0D61B353FCC42358F962A3C /* libPods-MasonryTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */; };
3132
/* End PBXBuildFile section */
3233

@@ -77,6 +78,7 @@
7778
DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASAdditions.h"; sourceTree = "<group>"; };
7879
DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MASAdditions.m"; sourceTree = "<group>"; };
7980
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>"; };
8082
DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MasonryTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
8183
/* End PBXFileReference section */
8284

@@ -187,6 +189,7 @@
187189
children = (
188190
DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */,
189191
DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */,
192+
DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */,
190193
);
191194
name = Additions;
192195
sourceTree = "<group>";
@@ -216,6 +219,7 @@
216219
files = (
217220
DD52F264179CB327005CD195 /* Masonry.h in Headers */,
218221
DD52F265179CB32B005CD195 /* UIView+MASAdditions.h in Headers */,
222+
DDE2653F179D24E600D48565 /* UIView+MASShorthandAdditions.h in Headers */,
219223
DD52F266179CB33F005CD195 /* MASConstraint.h in Headers */,
220224
DD52F267179CB342005CD195 /* MASConstraintBuilder.h in Headers */,
221225
DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */,
@@ -459,12 +463,10 @@
459463
DSTROOT = /tmp/Masonry.dst;
460464
GCC_PRECOMPILE_PREFIX_HEADER = YES;
461465
GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
462-
OTHER_LDFLAGS = (
463-
"-ObjC",
464-
"-all_load",
465-
);
466+
OTHER_LDFLAGS = "-ObjC";
466467
PRODUCT_NAME = "$(TARGET_NAME)";
467468
SKIP_INSTALL = YES;
469+
VALID_ARCHS = "armv7 armv7s i386 x86_64";
468470
};
469471
name = Debug;
470472
};
@@ -474,12 +476,10 @@
474476
DSTROOT = /tmp/Masonry.dst;
475477
GCC_PRECOMPILE_PREFIX_HEADER = YES;
476478
GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
477-
OTHER_LDFLAGS = (
478-
"-ObjC",
479-
"-all_load",
480-
);
479+
OTHER_LDFLAGS = "-ObjC";
481480
PRODUCT_NAME = "$(TARGET_NAME)";
482481
SKIP_INSTALL = YES;
482+
VALID_ARCHS = "armv7 armv7s i386 x86_64";
483483
};
484484
name = Release;
485485
};

Masonry.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Masonry.xcworkspace/contents.xcworkspacedata

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Masonry/MASConstraint.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
@protocol MASConstraint <NSObject>
1212

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);
2222

2323
- (void)commit;
2424

Masonry/Masonry.h

+4
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77
//
88

99
#import "UIView+MASAdditions.h"
10+
#import "UIView+MASShorthandAdditions.h"
11+
#import "MASConstraint.h"
12+
#import "MASCompositeConstraint.h"
13+
#import "MASViewAttribute.h"
1014
#import "MASViewConstraint.h"
1115
#import "MASConstraintBuilder.h"

Masonry/UIView+MASAdditions.h

+1-24
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#import "MASConstraintBuilder.h"
1111
#import "MASViewAttribute.h"
1212

13-
1413
@interface UIView (MASAdditions)
1514

1615
@property (nonatomic, strong, readonly) MASViewAttribute *mas_left;
@@ -27,26 +26,4 @@
2726

2827
- (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
2928

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

Masonry/UIView+MASAdditions.m

+1-26
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,4 @@ - (MASViewAttribute *)mas_baseline {
6363
return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline];
6464
}
6565

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
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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

MasonryExamples/MasonryExamples.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)