Skip to content

Commit 53a095b

Browse files
committed
support safeAreaLayoutGuide - rename
1 parent a2f1d06 commit 53a095b

3 files changed

Lines changed: 42 additions & 68 deletions

File tree

Examples/Masonry iOS Examples/MASExampleSafeAreaLayoutGuideViewController.m

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,66 +54,66 @@ - (void)viewDidLoad {
5454
const CGFloat size = 50.0;
5555

5656
[view1 mas_makeConstraints:^(MASConstraintMaker *make) {
57-
make.edges.equalTo(self.view.mas_safeArea).inset(10.0);
57+
make.edges.equalTo(self.view.mas_safeAreaLayoutGuide).inset(10.0);
5858
}];
5959

6060
[view2 mas_makeConstraints:^(MASConstraintMaker *make) {
61-
make.center.equalTo(self.view.mas_safeArea);
62-
make.width.height.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 40.0, - 40.0));
61+
make.center.equalTo(self.view.mas_safeAreaLayoutGuide);
62+
make.width.height.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 40.0, - 40.0));
6363
}];
6464

6565
[view3 mas_makeConstraints:^(MASConstraintMaker *make) {
66-
make.center.equalTo(self.view.mas_safeArea);
67-
make.width.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 60.0, - 60.0));
68-
make.height.equalTo(self.view.mas_safeArea).sizeOffset(CGSizeMake(- 60.0, - 60.0));
66+
make.center.equalTo(self.view.mas_safeAreaLayoutGuide);
67+
make.width.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 60.0, - 60.0));
68+
make.height.equalTo(self.view.mas_safeAreaLayoutGuide).sizeOffset(CGSizeMake(- 60.0, - 60.0));
6969
}];
7070

7171
[leftTopView mas_makeConstraints:^(MASConstraintMaker *make) {
72-
make.left.top.equalTo(self.view.mas_safeArea);
72+
make.left.top.equalTo(self.view.mas_safeAreaLayoutGuide);
7373
make.width.height.equalTo(@(size));
7474
}];
7575

7676
[rightTopView mas_makeConstraints:^(MASConstraintMaker *make) {
77-
make.right.equalTo(self.view.mas_safeAreaRight);
78-
make.top.equalTo(self.view.mas_safeAreaTop);
77+
make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
78+
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
7979
make.width.height.equalTo(@(size));
8080
}];
8181

8282
[leftBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
83-
make.left.equalTo(self.view.mas_safeAreaLeft);
84-
make.bottom.equalTo(self.view.mas_safeAreaBottom);
83+
make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
84+
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
8585
make.width.height.equalTo(@(size));
8686
}];
8787

8888
[rightBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
89-
make.right.bottom.equalTo(self.view.mas_safeArea);
89+
make.right.bottom.equalTo(self.view.mas_safeAreaLayoutGuide);
9090
make.width.height.equalTo(@(size));
9191
}];
9292

9393
[leftView mas_makeConstraints:^(MASConstraintMaker *make) {
94-
make.left.centerY.equalTo(self.view.mas_safeArea);
94+
make.left.centerY.equalTo(self.view.mas_safeAreaLayoutGuide);
9595
make.width.height.equalTo(@(size));
9696
}];
9797

9898
[rightView mas_makeConstraints:^(MASConstraintMaker *make) {
99-
make.right.equalTo(self.view.mas_safeAreaRight);
100-
make.centerY.equalTo(self.view.mas_safeAreaCenterY);
99+
make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
100+
make.centerY.equalTo(self.view.mas_safeAreaLayoutGuideCenterY);
101101
make.width.height.equalTo(@(size));
102102
}];
103103

104104
[topView mas_makeConstraints:^(MASConstraintMaker *make) {
105-
make.top.equalTo(self.view.mas_safeAreaTop);
106-
make.centerX.equalTo(self.view.mas_safeAreaCenterX);
105+
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
106+
make.centerX.equalTo(self.view.mas_safeAreaLayoutGuideCenterX);
107107
make.width.height.equalTo(@(size));
108108
}];
109109

110110
[bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
111-
make.bottom.centerX.equalTo(self.view.mas_safeArea);
111+
make.bottom.centerX.equalTo(self.view.mas_safeAreaLayoutGuide);
112112
make.width.height.equalTo(@(size));
113113
}];
114114

115115
[centerView mas_makeConstraints:^(MASConstraintMaker *make) {
116-
make.center.equalTo(self.view.mas_safeArea);
116+
make.center.equalTo(self.view.mas_safeAreaLayoutGuide);
117117
make.width.height.equalTo(@(size));
118118
}];
119119
}

Masonry/View+MASAdditions.h

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,18 @@
5454

5555
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
5656

57-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeArea;
58-
59-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLeading;
60-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaTrailing;
61-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLeft;
62-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaRight;
63-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaTop;
64-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaBottom;
65-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaWidth;
66-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaHeight;
67-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaCenterX;
68-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaCenterY;
69-
70-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide DEPRECATED_ATTRIBUTE;
71-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop DEPRECATED_ATTRIBUTE;
72-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom DEPRECATED_ATTRIBUTE;
73-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft DEPRECATED_ATTRIBUTE;
74-
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight DEPRECATED_ATTRIBUTE;
57+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide;
58+
59+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeading;
60+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTrailing;
61+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft;
62+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight;
63+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop;
64+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom;
65+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideWidth;
66+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideHeight;
67+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterX;
68+
@property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideCenterY;
7569

7670
#endif
7771

Masonry/View+MASAdditions.m

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -136,70 +136,50 @@ - (MASViewAttribute *)mas_centerYWithinMargins {
136136

137137
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
138138

139-
#pragma mark - safeAreaLayoutGuide
140-
141-
- (MASViewAttribute *)mas_safeArea {
139+
- (MASViewAttribute *)mas_safeAreaLayoutGuide {
142140
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeNotAnAttribute];
143141
}
144142

145-
- (MASViewAttribute *)mas_safeAreaLeading {
143+
- (MASViewAttribute *)mas_safeAreaLayoutGuideLeading {
146144
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeading];
147145
}
148146

149-
- (MASViewAttribute *)mas_safeAreaTrailing {
147+
- (MASViewAttribute *)mas_safeAreaLayoutGuideTrailing {
150148
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTrailing];
151149
}
152150

153-
- (MASViewAttribute *)mas_safeAreaLeft {
151+
- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft {
154152
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft];
155153
}
156154

157-
- (MASViewAttribute *)mas_safeAreaRight {
155+
- (MASViewAttribute *)mas_safeAreaLayoutGuideRight {
158156
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight];
159157
}
160158

161-
- (MASViewAttribute *)mas_safeAreaTop {
159+
- (MASViewAttribute *)mas_safeAreaLayoutGuideTop {
162160
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop];
163161
}
164162

165-
- (MASViewAttribute *)mas_safeAreaBottom {
163+
- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom {
166164
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
167165
}
168166

169-
- (MASViewAttribute *)mas_safeAreaWidth {
167+
- (MASViewAttribute *)mas_safeAreaLayoutGuideWidth {
170168
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeWidth];
171169
}
172170

173-
- (MASViewAttribute *)mas_safeAreaHeight {
171+
- (MASViewAttribute *)mas_safeAreaLayoutGuideHeight {
174172
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeHeight];
175173
}
176174

177-
- (MASViewAttribute *)mas_safeAreaCenterX {
175+
- (MASViewAttribute *)mas_safeAreaLayoutGuideCenterX {
178176
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterX];
179177
}
180178

181-
- (MASViewAttribute *)mas_safeAreaCenterY {
179+
- (MASViewAttribute *)mas_safeAreaLayoutGuideCenterY {
182180
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeCenterY];
183181
}
184182

185-
#pragma mark - DEPRECATED
186-
187-
- (MASViewAttribute *)mas_safeAreaLayoutGuide {
188-
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
189-
}
190-
- (MASViewAttribute *)mas_safeAreaLayoutGuideTop {
191-
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop];
192-
}
193-
- (MASViewAttribute *)mas_safeAreaLayoutGuideBottom {
194-
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
195-
}
196-
- (MASViewAttribute *)mas_safeAreaLayoutGuideLeft {
197-
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft];
198-
}
199-
- (MASViewAttribute *)mas_safeAreaLayoutGuideRight {
200-
return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight];
201-
}
202-
203183
#endif
204184

205185
#pragma mark - associated properties

0 commit comments

Comments
 (0)