feat: user interaction enabled false

This commit is contained in:
Juanpe Catalán
2019-08-26 19:10:44 +02:00
parent 93769902a3
commit bcd0fa7983
3 changed files with 5 additions and 2 deletions
@@ -29,6 +29,6 @@ extension CollectionSkeleton where Self: UIScrollView {
var estimatedNumberOfRows: Int { return 0 }
func addDummyDataSource() {}
func removeDummyDataSource(reloadAfter: Bool) {}
func disableUserInteraction() { isScrollEnabled = false }
func enableUserInteraction() { isScrollEnabled = true }
func disableUserInteraction() { isUserInteractionEnabled = false; isScrollEnabled = false }
func enableUserInteraction() { isUserInteractionEnabled = true; isScrollEnabled = true }
}
@@ -11,6 +11,7 @@ import UIKit
extension UIView {
func addDummyDataSourceIfNeeded() {
guard let collection = self as? CollectionSkeleton else { return }
status = .on
collection.addDummyDataSource()
collection.disableUserInteraction()
}
@@ -22,6 +23,7 @@ extension UIView {
func removeDummyDataSourceIfNeeded(reloadAfter reload: Bool = true) {
guard let collection = self as? CollectionSkeleton else { return }
status = .off
collection.removeDummyDataSource(reloadAfter: reload)
collection.enableUserInteraction()
}
@@ -7,6 +7,7 @@ extension CALayer {
insertSublayer(layer.contentLayer, at: idx)
switch transition {
case .none:
completion?()
break
case .crossDissolve(let duration):
layer.contentLayer.setOpacity(from: 0, to: 1, duration: duration, completion: completion)