Objective-C
[textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsZero).priorityLow();
make.top.mas_equalTo(imageView.mas_bottom).offset(20);
}];
I want change swift code. please help me?? thanks.
Objective-C
[textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsZero).priorityLow();
make.top.mas_equalTo(imageView.mas_bottom).offset(20);
}];
I want change swift code. please help me?? thanks.
These code make work
btn.mas_makeConstraints { (make:MASConstraintMaker?) in
make?.top.equalTo()(view.mas_top)?.with().offset()(0)
make?.left.equalTo()(view.mas_left)?.with().offset()(0)
make?.right.equalTo()(view.mas_right)?.with().offset()(0)
make?.bottom.equalTo()(view.mas_bottom)?.with().offset()(0)
return()
}
The shortest way to do it (if you want to mirror edges
of parent view is)
self.xibView .mas_makeConstraints( { make in
_ = make?.edges.equalTo()(self)
})
This assignment _ =
also will silence the warning about un-assignment.
You can also use SnapKit, which is the Swift only version of Masonry. It looks like they have decided not to deprecate Masonry, as was previously the case, but is still a good idea for your Swift only projects. If you are familiar with Masonry, you can migrate to SnapKit very easily.