Commit b7a1d22a by Daniel Dahan

development: updated CollectionViewCard and BottomSheetController

parent 6e0141ee
......@@ -431,7 +431,7 @@ open class BottomSheetController: RootController {
isUserInteractionEnabled = false
delegate?.bottomSheetController?(bottomSheetController: self, willOpen: .right)
delegate?.bottomSheetControllerWillOpen?(bottomSheetController: self)
UIView.animate(withDuration: TimeInterval(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.y / velocity)))),
animations: { [weak self, v = v] in
......@@ -446,7 +446,7 @@ open class BottomSheetController: RootController {
return
}
s.delegate?.bottomSheetController?(bottomSheetController: s, didOpen: .right)
s.delegate?.bottomSheetControllerDidOpen?(bottomSheetController: s)
}
}
......@@ -467,7 +467,7 @@ open class BottomSheetController: RootController {
isUserInteractionEnabled = true
delegate?.bottomSheetController?(bottomSheetController: self, willClose: .left)
delegate?.bottomSheetControllerWillClose?(bottomSheetController: self)
UIView.animate(withDuration: TimeInterval(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.y / velocity)))),
animations: { [weak self, v = v] in
......@@ -484,7 +484,7 @@ open class BottomSheetController: RootController {
s.hideView(container: v)
s.delegate?.bottomSheetController?(bottomSheetController: s, didClose: .left)
s.delegate?.bottomSheetControllerDidClose?(bottomSheetController: s)
}
}
......@@ -700,7 +700,7 @@ extension BottomSheetController: UIGestureRecognizerDelegate {
return
}
delegate?.bottomSheetController?(bottomSheetController: self, didTapAt: recognizer.location(in: view), position: .left)
delegate?.bottomSheetController?(bottomSheetController: self, didTapAt: recognizer.location(in: view))
guard isBottomViewEnabled && isBottomViewOpened && !isPointContainedWithinView(container: v, point: recognizer.location(in: v)) else {
return
......
......@@ -46,8 +46,8 @@ open class CollectionViewCard: Card {
/// A reference to the dataSourceItems.
open var dataSourceItems = [DataSourceItem]()
/// An index of IndexPath to MenuItem.
open var indexForDataSourceItems = [IndexPath: Any]()
/// An index of IndexPath to DataSourceItem.
open var dataSourceItemsIndexPaths = [IndexPath: Any]()
/// A reference to the collectionView.
@IBInspectable
......@@ -96,9 +96,9 @@ extension CollectionViewCard {
extension CollectionViewCard: CollectionViewDelegate {
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let card = indexForDataSourceItems[indexPath] as? Card else {
return
}
// guard let card = dataSourceItemsIndexPaths[indexPath] as? Card else {
// return
// }
}
}
......@@ -121,7 +121,7 @@ extension CollectionViewCard: CollectionViewDataSource {
return cell
}
indexForDataSourceItems[indexPath] = card
dataSourceItemsIndexPaths[indexPath] = card
if .vertical == self.collectionView.scrollDirection {
card.width = cell.width
......
......@@ -294,7 +294,7 @@ extension Menu {
extension Menu: CollectionViewDelegate {
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let menuItem = collectionViewCard.indexForDataSourceItems[indexPath] as? MenuItem else {
guard let menuItem = collectionViewCard.dataSourceItemsIndexPaths[indexPath] as? MenuItem else {
return
}
......@@ -321,7 +321,7 @@ extension Menu: CollectionViewDataSource {
return cell
}
collectionViewCard.indexForDataSourceItems[indexPath] = menuItem
collectionViewCard.dataSourceItemsIndexPaths[indexPath] = menuItem
cell.menuItem = menuItem
cell.menuItem?.width = cell.width
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment