Last active
January 25, 2018 20:30
-
-
Save Kalvin126/4863703b72f434f2db2796a150283378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SnapKit | |
import UIKit | |
// MARK: - AutoLayout | |
extension UIView { | |
@discardableResult func addSubview<View: UIView>(_ subview: View, constraintMaker: (View, ConstraintMaker) -> Void) -> View { | |
subview.translatesAutoresizingMaskIntoConstraints = false | |
addSubview(subview) | |
subview.snp.makeConstraints { constraintMaker(subview, $0) } | |
return subview | |
} | |
} |
Author
Kalvin126
commented
Jan 25, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment