Skip to content

Commit

Permalink
Revise API
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Oct 26, 2019
1 parent 1e8db76 commit 8042121
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
28 changes: 24 additions & 4 deletions Rideau/RideauContainerBodyType.swift
Expand Up @@ -29,15 +29,35 @@ public protocol RideauContainerBodyType {
extension RideauContainerBodyType where Self : UIView {

public func requestUpdateLayout() {
guard let containerView = self.superview as? RideauContainerView else { return }
containerView.requestUpdateLayout()

var view: UIView? = superview

while view != nil {
guard let containerView = view as? RideauContainerView else {
view = view?.superview
continue
}
containerView.requestUpdateLayout()
return
}

}
}

extension RideauContainerBodyType where Self : UIViewController {

public func requestUpdateLayout() {
guard let containerView = self.view.superview as? RideauContainerView else { return }
containerView.requestUpdateLayout()

var view: UIView? = self.view.superview

while view != nil {
guard let containerView = view as? RideauContainerView else {
view = view?.superview
continue
}
containerView.requestUpdateLayout()
return
}

}
}
13 changes: 9 additions & 4 deletions Rideau/RideauMaskedCornerRoundedViewController.swift
Expand Up @@ -80,7 +80,8 @@ open class RideauMaskedCornerRoundedViewController : UIViewController {

headerView.translatesAutoresizingMaskIntoConstraints = false
headerView.setContentHuggingPriority(.required, for: .vertical)

headerView.setContentCompressionResistancePriority(.required, for: .vertical)

NSLayoutConstraint.activate([
headerView.topAnchor.constraint(equalTo: contentView.topAnchor),
headerView.rightAnchor.constraint(equalTo: contentView.rightAnchor),
Expand Down Expand Up @@ -114,7 +115,7 @@ open class RideauMaskedCornerRoundedViewController : UIViewController {

}

public func set(viewController: UIViewController) {
public func setBodyViewController(_ viewController: UIViewController) {

viewController.willMove(toParent: self)
addChild(viewController)
Expand All @@ -126,8 +127,12 @@ open class RideauMaskedCornerRoundedViewController : UIViewController {
viewController.view.rightAnchor.constraint(equalTo: contentView.rightAnchor),
viewController.view.leftAnchor.constraint(equalTo: contentView.leftAnchor),
viewController.view.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
])

])
}

@available(*, deprecated, renamed: "setBodyViewController")
public func set(viewController: UIViewController) {
setBodyViewController(viewController)
}
}

0 comments on commit 8042121

Please sign in to comment.