This file contains hidden or 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
class ListingView: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
initView() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
initView() |
This file contains hidden or 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
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
if ['RxSwift', 'RxCocoa', 'RxAlamofire', 'RxTest', 'RxBlocking'].include? target.name | |
target.build_configurations.each do |config| | |
config.build_settings['SWIFT_VERSION'] = '3.3' | |
end | |
end | |
end | |
end |
This file contains hidden or 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
extension Optional { | |
/** | |
Unwraps a value or returns the default value provided if it's nil | |
- parameter defaultValue: The default value that will be returned if the original value is nil | |
*/ | |
func unwrap(defaultValue: Wrapped) -> Wrapped { | |
guard let self = self else { | |
// Make the app crash in debug but not in production |
This file contains hidden or 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
public typealias ConstraintsConfiguration = (_ top: NSLayoutConstraint, _ left: NSLayoutConstraint, _ bottom: NSLayoutConstraint, _ right: NSLayoutConstraint) -> Void | |
extension UIView { | |
/** | |
Embeds a subview inside the current view and adds constraints to fit the subview in the whole view. An optional constraints configuration closure can be specified to do extra customization for the added constraints, or you can keep a reference for the added constraints in this closure. | |
- Parameter subview: The subview that will be added | |
- Parameter constraintsConfiguration: The constraint configuration that will be applied to the newly added constraints | |
*/ | |
public func addSubviewWithConstraints(_ subview: UIView, constraintsConfiguration: ConstraintsConfiguration? = nil) { | |
// Required to disable auto generation of constraints |
OlderNewer