Improve Swift syntax (#25)
* Replace init-ializable struct with enums * Add AnyObject requirement to protocols * Hide init?(coder aDecoder: NSCoder) func * Improve Swift syntax * Revert "Replace init-ializable struct with enums" This reverts commit 1be2e8c23cfc75959d7fd1c90028d1a7a257b7d1.
This commit is contained in:
parent
a9edeb1d71
commit
b0fb9e7eed
|
|
@ -18,7 +18,7 @@ import UIKit
|
|||
}
|
||||
```
|
||||
*/
|
||||
public protocol PanModalPresentable {
|
||||
public protocol PanModalPresentable: AnyObject {
|
||||
|
||||
/**
|
||||
The scroll view embedded in the view controller.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import UIKit
|
|||
sourceRect: .zero)
|
||||
```
|
||||
*/
|
||||
protocol PanModalPresenter {
|
||||
protocol PanModalPresenter: AnyObject {
|
||||
|
||||
/**
|
||||
A flag that returns true if the current presented view controller
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ class PanContainerView: UIView {
|
|||
addSubview(presentedView)
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError()
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +34,9 @@ extension UIView {
|
|||
from the view hierachy
|
||||
*/
|
||||
var panContainerView: PanContainerView? {
|
||||
return subviews.compactMap({ $0 as? PanContainerView }).first
|
||||
return subviews.first(where: { view -> Bool in
|
||||
view is PanContainerView
|
||||
}) as? PanContainerView
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue