SnapKit 3.0 is a complete re-write to take advantage of modern Swift 3.0 as well as
clean up the API. As such please use with caution and check your apps thoroughly
Breaking
- iOS 7.0 support has been removed
install
anduninstall
have been deprecated, useactivate
anddeactivate
instead- DSL is now accessed through
.snp.*
rather than.snp_*
. For exampleview.snp.makeConstraints { }
- Constraints are now updated through
update(offset:)
,update(inset:)
andupdate(priority:)
.inset()
will no longer takeCGPoint
orCGSize
as input.offset()
will no longer takeCGPoint
,CGSize
,EdgeInsets
as inputupdateConstraints
will no longer allow creating new constraints unless there are no existing constraints for the view. If it does generate new constraints it will throw a fatal error.UIEdgeInsets
are now have their right and bottom value inverted for more natural results such asmake.edges.equalTo(UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)).inset()
Enhancements
- Debugging output has been improved to show exact file/line number from which the broken constraint was created
- Exceptions thrown during constraint creation have been replaced with
fatalError
with better output - Constraints are now installed through
NSLayoutConstraint.activate
and what view they are added to is now deferred to UIKit - Added
var contentHugging<Axis>Priority: CGFloat
tomake
- Added
var contentCompressionResistance<Axis>Priority: CGFloat
tomake
- Added support for
UILayoutGuide
viamake.left.equalTo(guide.snp.top)
- Added support for constraining edges to margins or vice versa via
make.edges.equalTo(other.snp.margins)