Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully NS/UILayoutGuide and SwiftPM support #595

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
084f446
Add MASLayoutGuide for UI/NSLayoutGuide support
cntrump May 30, 2021
08e05b1
update deployment target of Masonry.podspec
cntrump May 30, 2021
dcbe1d9
move edges/size/center to MASLayoutConstraint protocol
cntrump May 30, 2021
7cf6452
add MASLayoutGuide as secondViewAttribute support
cntrump May 30, 2021
b59824e
add tvos deployment target
cntrump May 30, 2021
9301688
rename [MASConstraintMaker initWithView:item:] to [MASConstraintMaker…
cntrump May 30, 2021
a6d20a2
replace _firstViewAttribute with self.firstViewAttribute
cntrump May 31, 2021
852b469
add swiftpm support
cntrump May 31, 2021
3116754
Use Xcode 12 for travis
cntrump May 31, 2021
91b6f93
add shorthand for MASLayoutGuide
cntrump May 31, 2021
320cc21
unset translatesAutoresizingMaskIntoConstraints of MASLayoutGuide’s o…
cntrump Jun 1, 2021
cc7d2eb
fix MASLayoutGuide constant with value issue
cntrump Jun 1, 2021
37534c4
fix issue: can’t set width and height for MASLayoutGuide
cntrump Jun 1, 2021
9e83016
replace NS_DEPRECATED_IOS with API_DEPRECATED
cntrump Jun 1, 2021
21c1be7
improve un/install methods of MASViewConstraint
cntrump Jun 1, 2021
598ff1d
fix issue: MASLayoutGuide can’t remake constraints correctly
cntrump Jun 1, 2021
a3f8ed8
move MASShorthandAdditions implementation to sources
cntrump Jun 1, 2021
dead167
improve [MAS_VIEW mas_closestCommonSuperview:]
cntrump Jun 1, 2021
43635cb
add macro NS_ASSUME_NONNULL_BEGIN/END
cntrump Jun 3, 2021
92e1ecd
remove inline flag of _MASBoxValue method
cntrump Jun 3, 2021
41a55a2
update pod spec for travis ci
cntrump Jun 3, 2021
468998d
update updateConstraints of MASExampleUpdateView case
cntrump Jun 3, 2021
b114a99
support mix with swift
cntrump Jun 4, 2021
72b3031
remove useless macro MAS_DISCARDABLE_RESULT
cntrump Jun 4, 2021
99010cb
make MASConstraintDelegate public
cntrump Jun 4, 2021
4ee9477
replace id with instancetype for init method
cntrump Jun 4, 2021
73c3723
Use Xcode 12.5 for travis
cntrump Jun 4, 2021
4666e27
fix issue: build error with ObjC++
cntrump Jun 4, 2021
1866250
fix issue: build error with <iso646.h>
cntrump Jun 4, 2021
7fe0eda
add NS_DESIGNATED_INITIALIZER
cntrump Jun 4, 2021
fa1a87f
enable GitHub Actions
cntrump Jun 5, 2021
79bb3dc
update init method of examples
cntrump Jun 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue: MASLayoutGuide can’t remake constraints correctly
cntrump committed Jun 1, 2021
commit 598ff1d1195e6870d1bfbb05ca2f78db4d4da4a7
8 changes: 7 additions & 1 deletion Masonry/MASConstraintMaker.m
Original file line number Diff line number Diff line change
@@ -48,7 +48,13 @@ - (id)initWithLayoutGuide:(MASLayoutGuide *)layoutGuide {

- (NSArray *)install {
if (self.removeExisting) {
NSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.view];
NSArray *installedConstraints;
if ([self.item isKindOfClass:MASLayoutGuide.class]) {
installedConstraints = [MASViewConstraint installedConstraintsForLayoutGuide:self.item];
} else {
installedConstraints = [MASViewConstraint installedConstraintsForView:self.view];
}

for (MASConstraint *constraint in installedConstraints) {
[constraint uninstall];
}
2 changes: 2 additions & 0 deletions Masonry/MASViewConstraint.h
Original file line number Diff line number Diff line change
@@ -45,4 +45,6 @@
*/
+ (NSArray *)installedConstraintsForView:(MAS_VIEW *)view;

+ (NSArray *)installedConstraintsForLayoutGuide:(MASLayoutGuide *)layoutGuide API_AVAILABLE(macos(10.11), ios(9.0));

@end
13 changes: 12 additions & 1 deletion Masonry/MASViewConstraint.m
Original file line number Diff line number Diff line change
@@ -43,8 +43,15 @@ @interface MASLayoutGuide (MASConstraints)

@implementation MASLayoutGuide (MASConstraints)

static char kInstalledConstraintsKey;

- (NSMutableSet *)mas_installedConstraints {
return self.owningView.mas_installedConstraints;
NSMutableSet *constraints = objc_getAssociatedObject(self, &kInstalledConstraintsKey);
if (!constraints) {
constraints = [NSMutableSet set];
objc_setAssociatedObject(self, &kInstalledConstraintsKey, constraints, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
return constraints;
}

@end
@@ -96,6 +103,10 @@ + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view {
return [view.mas_installedConstraints allObjects];
}

+ (NSArray *)installedConstraintsForLayoutGuide:(MASLayoutGuide *)layoutGuide {
return [layoutGuide.mas_installedConstraints allObjects];
}

#pragma mark - Private

- (void)setLayoutConstant:(CGFloat)layoutConstant {