Skip to content

Commit

Permalink
Public support fixes and get rid of unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
balavor committed Oct 4, 2020
1 parent 6f7f052 commit 602dc5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,28 @@ public extension CollectionDirector {
struct EventsSubscriber {
typealias HeaderFooterEvent = (view: UICollectionReusableView, path: IndexPath, table: UICollectionView)

var layoutDidChange: ((_ old: UICollectionViewLayout, _ new: UICollectionViewLayout) -> UICollectionViewTransitionLayout?)? = nil
var targetOffset: ((_ proposedContentOffset: CGPoint) -> CGPoint)? = nil
var moveItemPath: ((_ originalIndexPath: IndexPath, _ proposedIndexPath: IndexPath) -> IndexPath)? = nil
public var layoutDidChange: ((_ old: UICollectionViewLayout, _ new: UICollectionViewLayout) -> UICollectionViewTransitionLayout?)? = nil
public var targetOffset: ((_ proposedContentOffset: CGPoint) -> CGPoint)? = nil
public var moveItemPath: ((_ originalIndexPath: IndexPath, _ proposedIndexPath: IndexPath) -> IndexPath)? = nil

private var _shouldUpdateFocus: ((_ context: AnyObject) -> Bool)? = nil
@available(iOS 9.0, *)
var shouldUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext) -> Bool)? {
public var shouldUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext) -> Bool)? {
get { return _shouldUpdateFocus }
set { _shouldUpdateFocus = newValue as? ((AnyObject) -> Bool) }
}

private var _didUpdateFocus: ((_ context: AnyObject, _ coordinator: AnyObject) -> Void)? = nil
@available(iOS 9.0, *)
var didUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext, _ coordinator: UIFocusAnimationCoordinator) -> Void)? {
public var didUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext, _ coordinator: UIFocusAnimationCoordinator) -> Void)? {
get { return _didUpdateFocus }
set { _didUpdateFocus = newValue as? ((AnyObject, AnyObject) -> Void) }
}

var willDisplayHeader : ((HeaderFooterEvent) -> Void)? = nil
var willDisplayFooter : ((HeaderFooterEvent) -> Void)? = nil

var endDisplayHeader : ((HeaderFooterEvent) -> Void)? = nil
var endDisplayFooter : ((HeaderFooterEvent) -> Void)? = nil

private var _contextMenuPreview: ((_ context: AnyObject) -> AnyObject)? = nil
@available(iOS 13.0, *)
var contextMenuPreview: ((_ context: UIContextMenuConfiguration) -> UITargetedPreview)? {
get { _contextMenuPreview as? ((_ context: UIContextMenuConfiguration) -> UITargetedPreview)? ?? nil }
public var contextMenuPreview: ((_ context: UIContextMenuConfiguration) -> UITargetedPreview?)? {
get { _contextMenuPreview as? ((_ context: UIContextMenuConfiguration) -> UITargetedPreview?)? ?? nil }
set { _contextMenuPreview = newValue as? ((AnyObject) -> AnyObject) }
}
}
Expand Down
26 changes: 2 additions & 24 deletions Sources/Owl/Table/Protocols & Supports/TableDirector+Support.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,10 @@ import UIKit
public extension TableDirector {

/// Events you can monitor from the director and related to the table
struct TableEventsHandler {

var didScroll: ((UIScrollView) -> Void)? = nil
var endScrollingAnimation: ((UIScrollView) -> Void)? = nil

var shouldScrollToTop: ((UIScrollView) -> Bool)? = nil
var didScrollToTop: ((UIScrollView) -> Void)? = nil

var willBeginDragging: ((UIScrollView) -> Void)? = nil
var willEndDragging: ((_ scrollView: UIScrollView, _ velocity: CGPoint, _ targetOffset: UnsafeMutablePointer<CGPoint>) -> Void)? = nil
var endDragging: ((_ scrollView: UIScrollView, _ willDecelerate: Bool) -> Void)? = nil

var willBeginDecelerating: ((UIScrollView) -> Void)? = nil
var endDecelerating: ((UIScrollView) -> Void)? = nil

// zoom
var viewForZooming: ((UIScrollView) -> UIView?)? = nil
var willBeginZooming: ((_ scrollView: UIScrollView, _ view: UIView?) -> Void)? = nil
var endZooming: ((_ scrollView: UIScrollView, _ view: UIView?, _ scale: CGFloat) -> Void)? = nil
var didZoom: ((UIScrollView) -> Void)? = nil

var didChangeAdjustedContentInset: ((UIScrollView) -> Void)? = nil

struct TableEventsHandler {
private var _contextMenuPreview: ((_ context: AnyObject) -> AnyObject)? = nil
@available(iOS 13.0, *)
var contextMenuPreview: ((_ context: UIContextMenuConfiguration) -> UITargetedPreview)? {
public var contextMenuPreview: ((_ context: UIContextMenuConfiguration) -> UITargetedPreview)? {
get { _contextMenuPreview as? ((_ context: UIContextMenuConfiguration) -> UITargetedPreview)? ?? nil }
set { _contextMenuPreview = newValue as? ((AnyObject) -> AnyObject) }
}
Expand Down

0 comments on commit 602dc5c

Please sign in to comment.