diff options
author | Marino Faggiana <m.faggiana@twsweb.it> | 2018-11-12 12:51:51 +0300 |
---|---|---|
committer | Marino Faggiana <marinofaggiana@MacBook-Pro-di-Marino.local> | 2018-11-12 12:51:51 +0300 |
commit | eb406506a90d3f19c7ba313cc5e07ad419b7aaf1 (patch) | |
tree | 56c2e7759a2f9c59e96f5641d3a606c1d1682235 /Libraries external | |
parent | 175f774af14b3688abbb8185ea8bf9040ccdbf87 (diff) |
update project
Diffstat (limited to 'Libraries external')
48 files changed, 0 insertions, 2425 deletions
diff --git a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheet+Presenter.swift b/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheet+Presenter.swift deleted file mode 100755 index ed4d6858d..000000000 --- a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheet+Presenter.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// ActionSheet+Presenter.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-04-27. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -public extension ActionSheet { - - static var defaultPresenter: ActionSheetPresenter { - return defaultPresenter(for: UIDevice.current.userInterfaceIdiom) - } -} - - -// MARK: - Internal Extensions - -extension ActionSheet { - - static func defaultPresenter(for idiom: UIUserInterfaceIdiom) -> ActionSheetPresenter { - let isIpad = idiom == .pad - return isIpad ? ActionSheetPopoverPresenter() : ActionSheetDefaultPresenter() - } -} diff --git a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheet.swift b/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheet.swift deleted file mode 100755 index 39d1fda55..000000000 --- a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheet.swift +++ /dev/null @@ -1,368 +0,0 @@ -// -// ActionSheet.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This is the main class in the Sheeeeeeeeet library. You can - use it to create action sheets and present them in any view - controller, from any source view or bar button item. - - To create an action sheet, just call the initializer with a - list of items and buttons and a block that should be called - whenever an item is selected. - - - ## Custom presentation - - You can also inject a custom sheet presenter if you want to - customize how your sheet is presented and dismissed. If you - do not use a custom presenter, `ActionSheetDefaultPresenter` - is used. It honors the default iOS behavior by using action - sheets on iPhones and popovers on iPad. - - - ## Subclassing - - `ActionSheet` can be subclassed, which may be nice whenever - you use Sheeeeeeeeet in your own app and want to use an app - specific domain model. For instance, if you want to present - a list of `Food` items, you could create a `FoodActionSheet` - subclass, that is responsible to populate itself with items. - When you subclass `ActionSheet` you can either override the - initializers. However, you could also just override `setup` - and configure the action sheet in your override. - - - ## Appearance - - Sheeeeeeeeet's action sheet appearance if easily customized. - To change the global appearance for every action sheet that - is used in your app, use `UIActionSheetAppearance.standard`. - To change the appearance of a single action sheet, use it's - `appearance` property. To change the appearance of a single - item, use it's `appearance` property. - - - ## Triggered actions - - `ActionSheet` has two actions that are triggered by tapping - an item. `itemTapAction` is used by the sheet itself when a - tap occurs on an item. You can override this if you want to, - but you don't have to. `itemSelectAction`, however, must be - set to detect when an item is selected after a tap. This is - the main item action to observe, and the action you provide - in the initializer. - - */ - -import UIKit - -open class ActionSheet: UIViewController { - - - // MARK: - Initialization - - public init( - items: [ActionSheetItem], - presenter: ActionSheetPresenter = ActionSheet.defaultPresenter, - action: @escaping SelectAction) { - self.presenter = presenter - itemSelectAction = action - super.init(nibName: nil, bundle: nil) - setupItemsAndButtons(with: items) - setup() - } - - public required init?(coder aDecoder: NSCoder) { - presenter = ActionSheet.defaultPresenter - itemSelectAction = { _, _ in print("itemSelectAction is not set") } - super.init(coder: aDecoder) - setup() - } - - deinit { print("\(type(of: self)) deinit") } - - - // MARK: - Setup - - open func setup() { - view.backgroundColor = .clear - } - - - // MARK: - View Controller Lifecycle - - open override func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - prepareForPresentation() - } - - - // MARK: - Typealiases - - public typealias SelectAction = (ActionSheet, ActionSheetItem) -> () - public typealias TapAction = (ActionSheetItem) -> () - - - // MARK: - Dependencies - - open var appearance = ActionSheetAppearance(copy: .standard) - - open var presenter: ActionSheetPresenter - - - // MARK: - Actions - - open var itemSelectAction: SelectAction - - open lazy var itemTapAction: TapAction = { [weak self] item in - self?.handleTap(on: item) - } - - - // MARK: - Item Properties - - open var buttons = [ActionSheetButton]() - - open var items = [ActionSheetItem]() - - - // MARK: - Properties - - open var availableItemHeight: CGFloat { - return UIScreen.main.bounds.height - - 2 * margin(at: .top) - - margin(at: .bottom) - - headerSectionHeight - - buttonsSectionHeight - } - - open var bottomPresentationFrame: CGRect { - guard let view = view.superview else { return .zero } - var frame = view.frame - let leftMargin = margin(at: .left) - let rightMargin = margin(at: .right) - let maxMargin = max(leftMargin, rightMargin) - frame = frame.insetBy(dx: maxMargin, dy: 0) - frame.size.height = contentHeight - frame.origin.y = view.frame.height - contentHeight - frame.origin.y -= margin(at: .bottom) - return frame - } - - open var buttonsSectionHeight: CGFloat { - return buttonsViewHeight - } - - open var buttonsViewHeight: CGFloat { - return buttons.reduce(0) { $0 + $1.appearance.height } - } - - open var contentHeight: CGFloat { - return headerSectionHeight + itemsSectionHeight + buttonsSectionHeight - } - - open var contentWidth: CGFloat { - return super.preferredContentSize.width - } - - open var headerSectionHeight: CGFloat { - guard headerViewHeight > 0 else { return 0 } - return headerViewHeight + appearance.contentInset - } - - open var headerViewHeight: CGFloat { - return headerView?.frame.height ?? 0 - } - - open var itemsSectionHeight: CGFloat { - guard itemsViewHeight > 0 else { return 0 } - guard buttonsSectionHeight > 0 else { return itemsViewHeight } - return itemsViewHeight + appearance.contentInset - } - - open var itemsViewHeight: CGFloat { - let required = requiredItemHeight - let available = availableItemHeight - return min(required, available) - } - - open var itemsViewRequiresScrolling: Bool { - let required = requiredItemHeight - let available = availableItemHeight - return available < required - } - - open override var preferredContentSize: CGSize { - get { return CGSize(width: contentWidth, height: contentHeight) } - set { super.preferredContentSize = newValue } - } - - open var preferredPopoverSize: CGSize { - let width = appearance.popover.width - return CGSize(width: width, height: contentHeight) - } - - open var requiredItemHeight: CGFloat { - return items.reduce(0) { $0 + $1.appearance.height } - } - - - // MARK: - View Properties - - open lazy var buttonsView: UITableView = { - let tableView = createTableView(handler: buttonHandler) - view.addSubview(tableView) - return tableView - }() - - open var headerView: UIView? { - didSet { - oldValue?.removeFromSuperview() - guard let header = headerView else { return } - view.addSubview(header) - } - } - - open lazy var itemsView: UITableView = { - let tableView = createTableView(handler: itemHandler) - view.addSubview(tableView) - return tableView - }() - - - // MARK: - Data Properties - - public lazy var buttonHandler = ActionSheetItemHandler(actionSheet: self, handles: .buttons) - - public lazy var itemHandler = ActionSheetItemHandler(actionSheet: self, handles: .items) - - - // MARK: - Presentation Functions - - open func applyAppearance() { - itemsView.separatorColor = appearance.itemsSeparatorColor - buttonsView.separatorColor = appearance.buttonsSeparatorColor - } - - open func dismiss(completion: @escaping () -> ()) { - presenter.dismiss { completion() } - } - - open func present(in vc: UIViewController, from view: UIView?) { - prepareForPresentation() - presenter.present(sheet: self, in: vc.rootViewController, from: view) - } - - open func present(in vc: UIViewController, from barButtonItem: UIBarButtonItem) { - prepareForPresentation() - presenter.present(sheet: self, in: vc.rootViewController, from: barButtonItem) - } - - open func prepareForPresentation() { - applyAppearance() - items.forEach { $0.applyAppearance(appearance) } - buttons.forEach { $0.applyAppearance(appearance) } - applyRoundCorners() - positionViews() - } - - - // MARK: - Public Functions - - open func margin(at margin: ActionSheetMargin) -> CGFloat { - let minimum = appearance.contentInset - return margin.value(in: view.superview, minimum: minimum) - } - - public func item(at indexPath: IndexPath) -> ActionSheetItem { - return items[indexPath.row] - } - - open func reloadData() { - itemsView.reloadData() - buttonsView.reloadData() - } - - open func setupItemsAndButtons(with items: [ActionSheetItem]) { - self.items = items.filter { !($0 is ActionSheetButton) } - buttons = items.compactMap { $0 as? ActionSheetButton } - reloadData() - } -} - - -// MARK: - Private Functions - -private extension ActionSheet { - - func applyRoundCorners() { - applyRoundCorners(to: headerView) - applyRoundCorners(to: itemsView) - applyRoundCorners(to: buttonsView) - } - - func applyRoundCorners(to view: UIView?) { - view?.clipsToBounds = true - view?.layer.cornerRadius = appearance.cornerRadius - } - - func createTableView(handler: ActionSheetItemHandler) -> UITableView { - let tableView = UITableView(frame: view.frame, style: .plain) - tableView.isScrollEnabled = false - tableView.tableFooterView = UIView.empty - tableView.cellLayoutMarginsFollowReadableWidth = false - tableView.dataSource = handler - tableView.delegate = handler - return tableView - } - - func handleTap(on item: ActionSheetItem) { - reloadData() - if item.tapBehavior == .dismiss { - dismiss { self.itemSelectAction(self, item) } - } else { - itemSelectAction(self, item) - } - } - - func positionViews() { - let width = view.frame.width - positionHeaderView(width: width) - positionItemsView(width: width) - positionButtonsView(width: width) - positionSheet() - } - - func positionSheet() { - guard let superview = view.superview else { return } - guard let frame = presenter.presentationFrame(for: self, in: superview) else { return } - view.frame = frame - } - - func positionButtonsView(width: CGFloat) { - buttonsView.frame.origin.x = 0 - buttonsView.frame.origin.y = headerSectionHeight + itemsSectionHeight - buttonsView.frame.size.width = width - buttonsView.frame.size.height = buttonsViewHeight - } - - func positionHeaderView(width: CGFloat) { - guard let view = headerView else { return } - view.frame.origin = .zero - view.frame.size.width = width - } - - func positionItemsView(width: CGFloat) { - itemsView.frame.origin.x = 0 - itemsView.frame.origin.y = headerSectionHeight - itemsView.frame.size.width = width - itemsView.frame.size.height = itemsViewHeight - itemsView.isScrollEnabled = itemsViewRequiresScrolling - } -} diff --git a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheetItemHandler.swift b/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheetItemHandler.swift deleted file mode 100755 index 5f2222f46..000000000 --- a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheetItemHandler.swift +++ /dev/null @@ -1,83 +0,0 @@ -// -// ActionSheetItemHandler.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetItemHandler: NSObject { - - - // MARK: - Initialization - - init(actionSheet: ActionSheet, handles itemType: ItemType) { - self.actionSheet = actionSheet - self.itemType = itemType - } - - - // MARK: - Enum - - public enum ItemType { - case items, buttons - } - - - // MARK: - Properties - - private weak var actionSheet: ActionSheet? - - private var itemType: ItemType - - private var items: [ActionSheetItem] { - switch itemType { - case .buttons: return actionSheet?.buttons ?? [] - case .items: return actionSheet?.items ?? [] - } - } -} - - -// MARK: - UITableViewDataSource - -extension ActionSheetItemHandler: UITableViewDataSource { - - public func item(at indexPath: IndexPath) -> ActionSheetItem { - return items[indexPath.row] - } - - public func numberOfSections(in tableView: UITableView) -> Int { - return 1 - } - - public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return items.count - } - - public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - return item(at: indexPath).cell(for: tableView) - } - - public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return CGFloat(item(at: indexPath).appearance.height) - } -} - - -// MARK: - UITableViewDelegate - -extension ActionSheetItemHandler: UITableViewDelegate { - - public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - guard items.count > indexPath.row else { return } - let item = self.item(at: indexPath) - let cell = tableView.cellForRow(at: indexPath) - tableView.deselectRow(at: indexPath, animated: true) - guard let sheet = actionSheet else { return } - item.handleTap(in: sheet, cell: cell) - sheet.itemTapAction(item) - } -} diff --git a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheetMargin.swift b/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheetMargin.swift deleted file mode 100755 index 339f4e418..000000000 --- a/Libraries external/Sheeeeeeeeet/ActionSheet/ActionSheetMargin.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// ActionSheetMargin.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-02-22. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -import UIKit - -public enum ActionSheetMargin { - case top, left, right, bottom - - func value(in view: UIView?) -> CGFloat? { - guard let view = view else { return nil } - if #available(iOS 11.0, *) { - let insets = view.safeAreaInsets - switch self { - case .top: return insets.top - case .left: return insets.left - case .right: return insets.right - case .bottom: return insets.bottom - } - } else { - return nil - } - } - - func value(in view: UIView?, minimum: CGFloat) -> CGFloat { - guard let value = self.value(in: view) else { return minimum } - return max(value, minimum) - } -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetAppearance.swift deleted file mode 100755 index 312c4ed38..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetAppearance.swift +++ /dev/null @@ -1,144 +0,0 @@ -// -// ActionSheetAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-18. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This class is used to specify the appearance for all action - sheets and action sheet items provided by Sheeeeeeeeet. Use - `ActionSheetAppearance.standard` to style all action sheets - in an entire app. You can then apply individual appearances - to individual action sheets and item types. - - The `item` appearance property is used as the base template - for all other item appearances. - - */ - -import UIKit - -open class ActionSheetAppearance { - - - // MARK: - Initialization - - public init() {} - - public init(copy: ActionSheetAppearance) { - cornerRadius = copy.cornerRadius - contentInset = copy.contentInset - - separatorColor = copy.separatorColor - itemsSeparatorColor = copy.itemsSeparatorColor ?? separatorColor - buttonsSeparatorColor = copy.buttonsSeparatorColor ?? separatorColor - - item = ActionSheetItemAppearance(copy: copy.item) - popover = ActionSheetPopoverApperance(copy: copy.popover) - - cancelButton = ActionSheetCancelButtonAppearance(copy: copy.cancelButton) - dangerButton = ActionSheetDangerButtonAppearance(copy: copy.dangerButton) - okButton = ActionSheetOkButtonAppearance(copy: copy.okButton) - - collectionItem = ActionSheetCollectionItemAppearance(copy: copy.collectionItem) - customItem = ActionSheetCustomItemAppearance(copy: copy.customItem) - linkItem = ActionSheetLinkItemAppearance(copy: copy.linkItem) - multiSelectItem = ActionSheetMultiSelectItemAppearance(copy: copy.multiSelectItem) - multiSelectToggleItem = ActionSheetMultiSelectToggleItemAppearance(copy: copy.multiSelectToggleItem) - selectItem = ActionSheetSelectItemAppearance(copy: copy.selectItem) - singleSelectItem = ActionSheetSingleSelectItemAppearance(copy: copy.singleSelectItem) - - sectionMargin = ActionSheetSectionMarginAppearance(copy: copy.sectionMargin) - sectionTitle = ActionSheetSectionTitleAppearance(copy: copy.sectionTitle) - title = ActionSheetTitleAppearance(copy: copy.title) - } - - - // MARK: - Properties - - public var cornerRadius: CGFloat = 10 - public var contentInset: CGFloat = 15 - - public var separatorColor: UIColor? - public var itemsSeparatorColor: UIColor? - public var buttonsSeparatorColor: UIColor? - - - // MARK: - Appearance Properties - - public static var standard = ActionSheetAppearance() - - public lazy var item: ActionSheetItemAppearance = { - return ActionSheetItemAppearance() - }() - - public lazy var popover: ActionSheetPopoverApperance = { - return ActionSheetPopoverApperance(width: 300) - }() - - - // MARK: - Buttons - - public lazy var cancelButton: ActionSheetCancelButtonAppearance = { - return ActionSheetCancelButtonAppearance(copy: item) - }() - - public lazy var dangerButton: ActionSheetDangerButtonAppearance = { - let appearance = ActionSheetDangerButtonAppearance(copy: item) - appearance.textColor = .red - return appearance - }() - - public lazy var okButton: ActionSheetOkButtonAppearance = { - return ActionSheetOkButtonAppearance(copy: item) - }() - - - // MARK: - Items - - public lazy var collectionItem: ActionSheetCollectionItemAppearance = { - return ActionSheetCollectionItemAppearance(copy: item) - }() - - public lazy var customItem: ActionSheetCustomItemAppearance = { - return ActionSheetCustomItemAppearance(copy: item) - }() - - public lazy var linkItem: ActionSheetLinkItemAppearance = { - return ActionSheetLinkItemAppearance(copy: item) - }() - - public lazy var multiSelectItem: ActionSheetMultiSelectItemAppearance = { - return ActionSheetMultiSelectItemAppearance(copy: selectItem) - }() - - public lazy var multiSelectToggleItem: ActionSheetMultiSelectToggleItemAppearance = { - return ActionSheetMultiSelectToggleItemAppearance(copy: item) - }() - - public lazy var selectItem: ActionSheetSelectItemAppearance = { - return ActionSheetSelectItemAppearance(copy: item) - }() - - public lazy var singleSelectItem: ActionSheetSingleSelectItemAppearance = { - return ActionSheetSingleSelectItemAppearance(copy: selectItem) - }() - - - // MARK: - Titles - - public lazy var sectionMargin: ActionSheetSectionMarginAppearance = { - return ActionSheetSectionMarginAppearance(copy: item) - }() - - public lazy var sectionTitle: ActionSheetSectionTitleAppearance = { - return ActionSheetSectionTitleAppearance(copy: item) - }() - - public lazy var title: ActionSheetTitleAppearance = { - return ActionSheetTitleAppearance(copy: item) - }() -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetItemAppearance.swift deleted file mode 100755 index f6c5e5d1f..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetItemAppearance.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// ActionSheetItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetItemAppearance { - - - // MARK: - Initialization - - public init() {} - - public init(copy: ActionSheetItemAppearance) { - backgroundColor = copy.backgroundColor - font = copy.font - height = copy.height - separatorInsets = copy.separatorInsets - textColor = copy.textColor - tintColor = copy.tintColor - subtitleFont = copy.subtitleFont - subtitleTextColor = copy.subtitleTextColor - } - - - // MARK: - Properties - - public var backgroundColor: UIColor? - public var font: UIFont? - public var height: CGFloat = 50 - public var separatorInsets: UIEdgeInsets = .zero - public var textColor: UIColor? - public var tintColor: UIColor? - public var subtitleFont: UIFont? - public var subtitleTextColor: UIColor? -} - - -// MARK: - Public Extensions - -public extension ActionSheetItemAppearance { - - public static var noSeparator: UIEdgeInsets { - return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: UIScreen.main.bounds.width) - } - - public func hideSeparator() { - separatorInsets = ActionSheetItemAppearance.noSeparator - } -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetPopoverApperance.swift b/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetPopoverApperance.swift deleted file mode 100755 index a6855a148..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/ActionSheetPopoverApperance.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// ActionSheetPopoverApperance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetPopoverApperance { - - - // MARK: - Initialization - - public init(width: CGFloat) { - self.width = width - } - - public init(copy: ActionSheetPopoverApperance) { - self.width = copy.width - } - - - // MARK: - Properties - - public var width: CGFloat -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetButtonItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetButtonItemAppearance.swift deleted file mode 100755 index 44032d2b5..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetButtonItemAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetButtonItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetButtonAppearance: ActionSheetItemAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetCancelButtonAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetCancelButtonAppearance.swift deleted file mode 100755 index 8e00c172c..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetCancelButtonAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetCancelButtonAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetCancelButtonAppearance: ActionSheetButtonAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetDangerButtonAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetDangerButtonAppearance.swift deleted file mode 100755 index 8e022c9a7..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetDangerButtonAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetDangerButtonAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-27. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetDangerButtonAppearance: ActionSheetButtonAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetOkButtonAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetOkButtonAppearance.swift deleted file mode 100755 index 0382ef6b1..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Buttons/ActionSheetOkButtonAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetOkButtonAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetOkButtonAppearance: ActionSheetButtonAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetCollectionItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetCollectionItemAppearance.swift deleted file mode 100755 index ef26b55b6..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetCollectionItemAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetCollectionItemAppearance.swift -// SheeeeeeeeetExample -// -// Created by Jonas Ullström (ullstrm) on 2018-02-23. -// Copyright © 2018 Jonas Ullström. All rights reserved. -// - -import Foundation - -open class ActionSheetCollectionItemAppearance: ActionSheetItemAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetCustomItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetCustomItemAppearance.swift deleted file mode 100755 index 0000b9a30..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetCustomItemAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetCustomItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-10-08. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -import Foundation - -open class ActionSheetCustomItemAppearance: ActionSheetItemAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetLinkItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetLinkItemAppearance.swift deleted file mode 100755 index 19cb9a9dd..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetLinkItemAppearance.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// ActionSheetLinkItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetLinkItemAppearance: ActionSheetItemAppearance { - - - // MARK: - Initialization - - public override init() { - super.init() - } - - public override init(copy: ActionSheetItemAppearance) { - super.init(copy: copy) - guard let copy = copy as? ActionSheetLinkItemAppearance else { return } - linkIcon = copy.linkIcon - } - - - // MARK: - Properties - - public var linkIcon: UIImage? -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetMultiSelectItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetMultiSelectItemAppearance.swift deleted file mode 100755 index f1c52fa7e..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetMultiSelectItemAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetMultiSelectItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-03-31. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -import Foundation - -open class ActionSheetMultiSelectItemAppearance: ActionSheetSelectItemAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetMultiSelectToggleItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetMultiSelectToggleItemAppearance.swift deleted file mode 100755 index fe11f03ee..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetMultiSelectToggleItemAppearance.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// ActionSheetMultiSelectToggleItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-03-31. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -import UIKit - -open class ActionSheetMultiSelectToggleItemAppearance: ActionSheetItemAppearance { - - - // MARK: - Initialization - - public override init() { - super.init() - } - - public override init(copy: ActionSheetItemAppearance) { - super.init(copy: copy) - guard let copy = copy as? ActionSheetMultiSelectToggleItemAppearance else { return } - deselectAllTextColor = copy.deselectAllTextColor - selectAllTextColor = copy.selectAllTextColor - } - - - // MARK: - Properties - - public var deselectAllTextColor: UIColor? - public var selectAllTextColor: UIColor? -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetSelectItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetSelectItemAppearance.swift deleted file mode 100755 index 03cdc949c..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetSelectItemAppearance.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// ActionSheetSelectItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This appearance inherits the base appearance and applies to - select items. The additional properties are applied when an - item is selected: - - * `selectedIcon` is displayed rightmost, e.g. a checkmark - * `selectedTextColor` is applied to the text (duh) - * `selectedTintColor` is applied to both icons if they are rendered as template images - * `selectedIconTintColor` can override `selectedTintColor` for the selected icon - - */ - -import UIKit - -open class ActionSheetSelectItemAppearance: ActionSheetItemAppearance { - - - // MARK: - Initialization - - public override init() { - super.init() - } - - public override init(copy: ActionSheetItemAppearance) { - super.init(copy: copy) - selectedTextColor = copy.textColor - selectedTintColor = copy.tintColor - guard let copy = copy as? ActionSheetSelectItemAppearance else { return } - selectedIcon = copy.selectedIcon - selectedTextColor = copy.selectedTextColor ?? selectedTextColor - selectedTintColor = copy.selectedTintColor ?? selectedTintColor - selectedIconTintColor = copy.selectedIconTintColor ?? selectedTintColor - } - - - // MARK: - Properties - - public var selectedIcon: UIImage? - public var selectedIconTintColor: UIColor? - public var selectedTextColor: UIColor? - public var selectedTintColor: UIColor? -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetSingleSelectItemAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetSingleSelectItemAppearance.swift deleted file mode 100755 index fc6c417fa..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Items/ActionSheetSingleSelectItemAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetSingleSelectItemAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-03-19. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -import Foundation - -open class ActionSheetSingleSelectItemAppearance: ActionSheetSelectItemAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetSectionMarginAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetSectionMarginAppearance.swift deleted file mode 100755 index a705a644e..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetSectionMarginAppearance.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// ActionSheetSectionMarginAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-27. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import Foundation - -open class ActionSheetSectionMarginAppearance: ActionSheetItemAppearance { - - - // MARK: - Initialization - - public override init() { - super.init() - hideSeparator() - } - - public override init(copy: ActionSheetItemAppearance) { - super.init(copy: copy) - hideSeparator() - } -} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetSectionTitleAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetSectionTitleAppearance.swift deleted file mode 100755 index 2cecbcaee..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetSectionTitleAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetSectionTitleAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-19. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import Foundation - -open class ActionSheetSectionTitleAppearance: ActionSheetItemAppearance {} diff --git a/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetTitleAppearance.swift b/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetTitleAppearance.swift deleted file mode 100755 index 9c0d8e0b1..000000000 --- a/Libraries external/Sheeeeeeeeet/Appearance/Titles/ActionSheetTitleAppearance.swift +++ /dev/null @@ -1,11 +0,0 @@ -// -// ActionSheetTitleAppearance.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-19. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import Foundation - -open class ActionSheetTitleAppearance: ActionSheetItemAppearance { } diff --git a/Libraries external/Sheeeeeeeeet/Extensions/NSObject+ClassName.swift b/Libraries external/Sheeeeeeeeet/Extensions/NSObject+ClassName.swift deleted file mode 100755 index 36534a023..000000000 --- a/Libraries external/Sheeeeeeeeet/Extensions/NSObject+ClassName.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// NSObject+ClassName.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -extension NSObject { - - static var className: String { - return String(describing: self) - } -} diff --git a/Libraries external/Sheeeeeeeeet/Extensions/UIView+Empty.swift b/Libraries external/Sheeeeeeeeet/Extensions/UIView+Empty.swift deleted file mode 100755 index d4a596540..000000000 --- a/Libraries external/Sheeeeeeeeet/Extensions/UIView+Empty.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// UIView+Empty.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-19. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -extension UIView { - - static var empty: UIView { - let view = UIView(frame: CGRect(x: 0, y: 0, width: 1, height: 1)) - view.backgroundColor = UIColor.clear - return view - } -} diff --git a/Libraries external/Sheeeeeeeeet/Extensions/UIViewController+RootViewController.swift b/Libraries external/Sheeeeeeeeet/Extensions/UIViewController+RootViewController.swift deleted file mode 100755 index cf157df8e..000000000 --- a/Libraries external/Sheeeeeeeeet/Extensions/UIViewController+RootViewController.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIViewController+RootViewController.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-12-01. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -import UIKit - -extension UIViewController { - - var rootViewController: UIViewController { - guard let parent = self.parent else { return self } - return parent.rootViewController - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/ActionSheetItem.swift b/Libraries external/Sheeeeeeeeet/Items/ActionSheetItem.swift deleted file mode 100755 index 84a6c35a3..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/ActionSheetItem.swift +++ /dev/null @@ -1,111 +0,0 @@ -// -// ActionSheetItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This class represents a regular action sheet item, like the - ones used in UIAlertController. It has a title, an optional - value and an optional image. All other item classes inherit - this class. - - The default tap behavior of action sheet items is "dismiss", - which means that the action sheet is told that the item was - tapped and is then dismissed. If you don't want the item to - dismiss the action sheet, set `tapBehavior` to `.none`. - - An action sheet item's appearance is set by the sheet, when - it is presented. To use custom appearances for single items, - just modify the item's `appearance` property. - - */ - -import UIKit - -open class ActionSheetItem: NSObject { - - - // MARK: - Initialization - - public init( - title: String, - subtitle: String? = nil, - value: Any? = nil, - image: UIImage? = nil, - tapBehavior: TapBehavior = .dismiss) { - let appearance = ActionSheetAppearance.standard.item - self.title = title - self.subtitle = subtitle - self.value = value - self.image = image - self.tapBehavior = tapBehavior - self.appearance = ActionSheetItemAppearance(copy: appearance) - super.init() - } - - - // MARK: - Enums - - public enum ItemType { - case item, button, title - } - - public enum TapBehavior { - case dismiss, none - } - - - // MARK: - Properties - - public var cellReuseIdentifier: String { return className } - public var className: String { return type(of: self).className } - open var itemType: ItemType { return .item } - - open var image: UIImage? - open var subtitle: String? - open var title: String - open var value: Any? - - open var appearance: ActionSheetItemAppearance - open var cellStyle: UITableViewCell.CellStyle = .default - open var customAppearance: ActionSheetItemAppearance? - open var tapBehavior: TapBehavior - - - // MARK: - Functions - - open func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = customAppearance ?? ActionSheetItemAppearance(copy: appearance.item) - } - - open func applyAppearance(to cell: UITableViewCell) { - if let color = appearance.backgroundColor { - cell.backgroundColor = color - } - cell.imageView?.image = image - cell.textLabel?.text = title - cell.selectionStyle = .default - cell.separatorInset = appearance.separatorInsets - cell.tintColor = appearance.tintColor - cell.textLabel?.textAlignment = .left - cell.textLabel?.textColor = appearance.textColor - cell.textLabel?.font = appearance.font - cell.detailTextLabel?.text = subtitle - cell.detailTextLabel?.font = appearance.subtitleFont - cell.detailTextLabel?.textColor = appearance.subtitleTextColor - } - - open func cell(for tableView: UITableView) -> UITableViewCell { - let id = cellReuseIdentifier - let cell = tableView.dequeueReusableCell(withIdentifier: id) as? ActionSheetItemCell - ?? ActionSheetItemCell(style: cellStyle, reuseIdentifier: id) - applyAppearance(to: cell) - return cell - } - - open func handleTap(in actionSheet: ActionSheet, cell: UITableViewCell? = nil) {} -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetButton.swift b/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetButton.swift deleted file mode 100755 index 469cd3c04..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetButton.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// ActionSheetButton.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This class is a base class for all action sheet buttons. It - is not intended to be used directly. Instead, use the built - in buttons or subclass this class to create your own button. - - */ - -import UIKit - -open class ActionSheetButton: ActionSheetItem { - - - // MARK: - Initialization - - public init(title: String, value: Bool?) { - super.init(title: title, value: value) - } - - - // MARK: - Properties - - open override var itemType: ItemType { return .button } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetButtonAppearance(copy: appearance.okButton) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - cell.textLabel?.textAlignment = .center - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetCancelButton.swift b/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetCancelButton.swift deleted file mode 100755 index 1602ab085..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetCancelButton.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// ActionSheetCancelButton.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Cancel buttons have no special behavior, but can be used in - sheets where a user applies changes by tapping an OK button. - The default cancel button value is `nil`. - - */ - -import UIKit - -open class ActionSheetCancelButton: ActionSheetButton { - - - // MARK: - Initialization - - public init(title: String) { - super.init(title: title, value: nil) - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetCancelButtonAppearance(copy: appearance.cancelButton) - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetDangerButton.swift b/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetDangerButton.swift deleted file mode 100755 index 8baa027d2..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetDangerButton.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// ActionSheetDangerButton.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-27. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Danger buttons have no special behavior, but can be used to - indicate that the effect of the action sheet is destructive. - - The value of a danger button is `true` by default. - - */ - -import UIKit - -open class ActionSheetDangerButton: ActionSheetButton { - - - // MARK: - Initialization - - public init(title: String) { - super.init(title: title, value: true) - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetDangerButtonAppearance(copy: appearance.dangerButton) - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetOkButton.swift b/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetOkButton.swift deleted file mode 100755 index 37ecb5e38..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Buttons/ActionSheetOkButton.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// ActionSheetOkButton.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - OK buttons have no special behavior, but can be used when a - user should apply action sheet changes by tapping an button. - - The value of an OK button is `true` by default. - - */ - -import UIKit - -open class ActionSheetOkButton: ActionSheetButton { - - - // MARK: - Initialization - - public init(title: String) { - super.init(title: title, value: true) - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetOkButtonAppearance(copy: appearance.okButton) - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetCollectionItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetCollectionItem.swift deleted file mode 100755 index cdd00fc43..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetCollectionItem.swift +++ /dev/null @@ -1,130 +0,0 @@ -// -// ActionSheetCollectionItem.swift -// Sheeeeeeeeet -// -// Created by Jonas Ullström (ullstrm) on 2018-03-01. -// Copyright © 2018 Jonas Ullström. All rights reserved. -// - -/* - - Collection items can be used to present item collections in - a collection view, using cell types that you define in your - project and implement `ActionSheetCollectionItemContentCell`. - The cell `.xib` should have the same name as the cell class. - - This class will dequeue a different cell type than standard - action sheet items. If you look at `cell(for: ...)`, you'll - see that it uses `ActionSheetCollectionItemCell` for its id. - - */ - -import Foundation - -open class ActionSheetCollectionItem<T>: ActionSheetItem, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout where T: ActionSheetCollectionItemContentCell { - - - // MARK: - Initialization - - public init( - itemCellType: T.Type, - itemCount: Int, - setupAction: @escaping CellAction, - selectionAction: @escaping CellAction) { - self.itemCellType = itemCellType - self.itemCount = itemCount - self.setupAction = setupAction - self.selectionAction = selectionAction - super.init(title: "") - } - - - // MARK: - Typealiases - - public typealias CellAction = (_ cell: T, _ index: Int) -> () - - - // MARK: - Properties - - public let itemCellType: T.Type - public let itemCount: Int - public private(set) var selectionAction: CellAction - public let setupAction: CellAction - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetCollectionItemAppearance(copy: appearance.collectionItem) - self.appearance.height = T.defaultSize.height + T.topInset + T.bottomInset + 0.5 - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - guard let itemCell = cell as? ActionSheetCollectionItemCell else { return } - itemCell.setup(withNib: T.nib, owner: self) - } - - open override func cell(for tableView: UITableView) -> UITableViewCell { - tableView.register(ActionSheetCollectionItemCell.nib, forCellReuseIdentifier: cellReuseIdentifier) - return super.cell(for: tableView) - } - - open func extendSelectionAction(toReload actionSheet: ActionSheet) { - weak var sheet = actionSheet - extendSelectionAction(with: { _, _ in - sheet?.reloadData() - }) - } - - open func extendSelectionAction(with action: @escaping CellAction) { - let currentSelectionAction = selectionAction - selectionAction = { cell, index in - currentSelectionAction(cell, index) - action(cell, index) - } - } - - - // MARK: - UICollectionViewDataSource - - open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return itemCount - } - - open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let id = ActionSheetCollectionItemCell.itemCellIdentifier - let dequeued = collectionView.dequeueReusableCell(withReuseIdentifier: id, for: indexPath) - guard let cell = dequeued as? T else { return UICollectionViewCell() } - setupAction(cell, indexPath.row) - return cell - } - - - // MARK: - UICollectionViewDelegate - - open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - guard let cell = collectionView.cellForItem(at: indexPath) as? T else { return } - selectionAction(cell, indexPath.row) - } - - - // MARK: - FlowLayout delegate - - open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return T.defaultSize - } - - open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { - return UIEdgeInsets(top: T.topInset, left: T.leftInset, bottom: T.bottomInset, right: T.rightInset) - } - - open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { - return T.itemSpacing - } - - open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { - return 0 - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetCustomItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetCustomItem.swift deleted file mode 100755 index 8044b7c4c..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetCustomItem.swift +++ /dev/null @@ -1,64 +0,0 @@ -// -// ActionSheetCustomViewItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-10-08. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -/* - - Custom items can be used to present any view in your sheets. - Just specify the view type you want to use and make sure it - inherits `ActionSheetItemCell`, and that it also implements - `ActionSheetCustomItemCell`. - - */ - -import UIKit - -public class ActionSheetCustomItem<T>: ActionSheetItem where T: ActionSheetCustomItemCell { - - - // MARK: - Initialization - - public init(cellType: T.Type, setupAction: @escaping SetupAction) { - self.cellType = cellType - self.setupAction = setupAction - super.init( - title: "", - subtitle: nil, - value: nil, - image: nil, - tapBehavior: .none) - } - - - // MARK: - Typealiases - - public typealias SetupAction = (_ cell: T) -> () - - - // MARK: - Properties - - public let cellType: T.Type - public let setupAction: SetupAction - - - // MARK: - Functions - - public override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetCustomItemAppearance(copy: appearance.customItem) - self.appearance.height = T.defaultSize.height - } - - open override func cell(for tableView: UITableView) -> UITableViewCell { - tableView.register(T.nib, forCellReuseIdentifier: cellReuseIdentifier) - let cell = super.cell(for: tableView) - cell.selectionStyle = .none - guard let typedCell = cell as? T else { fatalError("Invalid cell type created by superclass") } - setupAction(typedCell) - return typedCell - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetLinkItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetLinkItem.swift deleted file mode 100755 index 251ac820e..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetLinkItem.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// ActionSheetLinkItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Link items can be used when tapping them will take the user - somewhere, e.g. to another view controller or a web site. - - */ - -import UIKit - -open class ActionSheetLinkItem: ActionSheetItem { - - - // MARK: - Properties - - open var linkAppearance: ActionSheetLinkItemAppearance? { - return appearance as? ActionSheetLinkItemAppearance - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetLinkItemAppearance(copy: appearance.linkItem) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - guard let appearance = linkAppearance else { return } - cell.accessoryView = UIImageView(image: appearance.linkIcon) - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetMultiSelectItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetMultiSelectItem.swift deleted file mode 100755 index e0e16d55e..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetMultiSelectItem.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// ActionSheetMultiSelectItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-03-31. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -/* - - `ActionSheetMultiSelectItem` should be used whenever a user - should be able to select one or several items in a sheet. A - multi select item will not affect other items, and will not - dismiss the sheet. - - Multi-select items can be used in combination with a toggle - item (`ActionSheetMultiSelectToggleItem`), which can toggle - the selected state of all items in the same group. - - A multi-select item does not dismiss the sheet, since users - will most probably be in a context where a change should be - applied with an OK button. - - */ - -import UIKit - -open class ActionSheetMultiSelectItem: ActionSheetSelectItem { - - - // MARK: - Initialization - - public init( - title: String, - isSelected: Bool, - group: String = "", - value: Any? = nil, - image: UIImage? = nil) { - super.init( - title: title, - isSelected: isSelected, - group: group, - value: value, - image: image, - tapBehavior: .none) - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetMultiSelectItemAppearance(copy: appearance.multiSelectItem) - } - - open override func handleTap(in actionSheet: ActionSheet, cell: UITableViewCell? = nil) { - super.handleTap(in: actionSheet, cell: cell) - let toggleItems = actionSheet.items.compactMap { $0 as? ActionSheetMultiSelectToggleItem } - let items = toggleItems.filter { $0.group == group } - items.forEach { $0.updateState(for: actionSheet) } - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetMultiSelectToggleItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetMultiSelectToggleItem.swift deleted file mode 100755 index e8debeb30..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetMultiSelectToggleItem.swift +++ /dev/null @@ -1,86 +0,0 @@ -// -// ActionSheetMultiSelectToggleItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-03-31. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -/* - - Multi-select toggle items can be used together with a group - of `ActionSheetMultiSelectItem`s. When tapped, it will make - all multi-select items in the same group select/deselect. - - Since this item must know about the multi-select items when - setting its select/deselect title text, you must provide it - with an initial `State` when creating it. After that, it is - able to update itself whenever it is tapped. - - */ - -import UIKit - -open class ActionSheetMultiSelectToggleItem: ActionSheetItem { - - - // MARK: - Initialization - - public init(title: String, state: State, group: String, selectAllTitle: String, deselectAllTitle: String) { - self.group = group - self.state = state - self.deselectAllTitle = deselectAllTitle - self.selectAllTitle = selectAllTitle - super.init( - title: title, - tapBehavior: .none) - cellStyle = .value1 - } - - - // MARK: - State - - public enum State { - case selectAll, deselectAll - } - - - // MARK: - Properties - - open var deselectAllTitle: String - open var group: String - open var selectAllTitle: String - open var state: State - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetMultiSelectToggleItemAppearance(copy: appearance.multiSelectToggleItem) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - guard let appearance = appearance as? ActionSheetMultiSelectToggleItemAppearance else { return } - let isSelectAll = state == .selectAll - subtitle = isSelectAll ? selectAllTitle : deselectAllTitle - appearance.subtitleTextColor = isSelectAll ? appearance.selectAllTextColor : appearance.deselectAllTextColor - super.applyAppearance(to: cell) - } - - open override func handleTap(in actionSheet: ActionSheet, cell: UITableViewCell? = nil) { - super.handleTap(in: actionSheet) - let selectItems = actionSheet.items.compactMap { $0 as? ActionSheetMultiSelectItem } - let items = selectItems.filter { $0.group == group } - let shouldSelectAll = items.contains { !$0.isSelected } - items.forEach { $0.isSelected = shouldSelectAll ? true : false } - updateState(for: actionSheet) - } - - open func updateState(for actionSheet: ActionSheet) { - let selectItems = actionSheet.items.compactMap { $0 as? ActionSheetMultiSelectItem } - let items = selectItems.filter { $0.group == group } - state = items.contains { !$0.isSelected } ? .selectAll : .deselectAll - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetSelectItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetSelectItem.swift deleted file mode 100755 index d66128949..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetSelectItem.swift +++ /dev/null @@ -1,82 +0,0 @@ -// -// ActionSheetSelectItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Select items are used to let the user select one or several - items in an action sheet. Unlike the `ActionSheetItem` type, - this type has an `isSelected` state, a selected icon and an - extended appearance. - - This item type is not meant to be used directly. However, a - `selectItem` appearance property is still available, so you - can style single and multiselect items in a single way. - - Instead of this type, you should use any of its subclasses: - - * `ActionSheetSingleSelectItem` - * `ActionSheetMultiSelectItem` - - */ - -import UIKit - -open class ActionSheetSelectItem: ActionSheetItem { - - - // MARK: - Initialization - - init( - title: String, - isSelected: Bool, - group: String = "", - value: Any? = nil, - image: UIImage? = nil, - tapBehavior: TapBehavior = .dismiss) { - self.isSelected = isSelected - self.group = group - super.init( - title: title, - value: value, - image: image, - tapBehavior: tapBehavior) - } - - - // MARK: - Properties - - open var group: String - - open var isSelected: Bool - - open var selectAppearance: ActionSheetSelectItemAppearance? { - return appearance as? ActionSheetSelectItemAppearance - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetSelectItemAppearance(copy: appearance.selectItem) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - guard let appearance = selectAppearance else { return } - cell.accessoryView = isSelected ? UIImageView(image: appearance.selectedIcon) : nil - cell.accessoryView?.tintColor = isSelected ? appearance.selectedIconTintColor : appearance.tintColor - cell.tintColor = isSelected ? appearance.selectedTintColor : appearance.tintColor - cell.textLabel?.textColor = isSelected ? appearance.selectedTextColor : appearance.textColor - } - - open override func handleTap(in actionSheet: ActionSheet, cell: UITableViewCell? = nil) { - super.handleTap(in: actionSheet, cell: cell) - isSelected = !isSelected - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetSingleSelectItem.swift b/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetSingleSelectItem.swift deleted file mode 100755 index 566b6a2fb..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Items/ActionSheetSingleSelectItem.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// ActionSheetSingleSelectItem.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-03-12. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -/* - - `ActionSheetSingleSelectItem` should be used whenever users - should only be able to select a single item in a sheet or a - group. It automatically deselects other single select items - in the same group. You can have several groups in one sheet. - - A single select item will dismiss the sheet when tapped. To - change this behavior, set `tapBehavior` to `.none`. - - */ - -import UIKit - -open class ActionSheetSingleSelectItem: ActionSheetSelectItem { - - - // MARK: - Initialization - - public init( - title: String, - isSelected: Bool, - group: String = "", - value: Any? = nil, - image: UIImage? = nil) { - super.init( - title: title, - isSelected: isSelected, - group: group, - value: value, - image: image) - } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - super.applyAppearance(appearance) - self.appearance = ActionSheetSingleSelectItemAppearance(copy: appearance.singleSelectItem) - } - - open override func handleTap(in actionSheet: ActionSheet, cell: UITableViewCell? = nil) { - super.handleTap(in: actionSheet, cell: cell) - let items = actionSheet.items.compactMap { $0 as? ActionSheetSingleSelectItem } - let deselectItems = items.filter { $0.group == group } - deselectItems.forEach { $0.isSelected = false } - isSelected = true - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetSectionMargin.swift b/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetSectionMargin.swift deleted file mode 100755 index 403818378..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetSectionMargin.swift +++ /dev/null @@ -1,44 +0,0 @@ -// -// ActionSheetSectionMargin.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-27. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Section margins items can be used to add additional spacing - before new sections. They are not selectable, but will send - a tap event to the action sheet in which they are used. - - */ - -import UIKit - -open class ActionSheetSectionMargin: ActionSheetItem { - - - // MARK: - Initialization - - public init() { - super.init(title: "", tapBehavior: .none) - } - - - // MARK: - Properties - - open override var itemType: ItemType { return .title } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetSectionMarginAppearance(copy: appearance.sectionMargin) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - cell.selectionStyle = .none - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetSectionTitle.swift b/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetSectionTitle.swift deleted file mode 100755 index 866a6a3a5..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetSectionTitle.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// ActionSheetSectionTitle.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Section title items can be used to segment action sheets in - sections. They serve no purpose beyond to visually indicate - that certain items belong together. A section item can have - a title and a subtitle. - - To add additional space above a section title, make sure to - add a `ActionSheetSectionMargin` before the section title. - - */ - -import UIKit - -open class ActionSheetSectionTitle: ActionSheetItem { - - - // MARK: - Initialization - - public init(title: String, subtitle: String? = nil) { - super.init(title: title, subtitle: subtitle, tapBehavior: .none) - cellStyle = .value1 - } - - - // MARK: - Properties - - open override var itemType: ItemType { return .title } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetSectionTitleAppearance(copy: appearance.sectionTitle) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - cell.selectionStyle = .none - } -} diff --git a/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetTitle.swift b/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetTitle.swift deleted file mode 100755 index fd66d007d..000000000 --- a/Libraries external/Sheeeeeeeeet/Items/Titles/ActionSheetTitle.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// ActionSheetTitle.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-26. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Title items can be used to add main titles to action sheets. - They are not selectable, but will still send a tap event to - the action sheet in which they are used. - - */ - -import UIKit - -open class ActionSheetTitle: ActionSheetItem { - - - // MARK: - Initialization - - public init(title: String) { - super.init(title: title, tapBehavior: .none) - } - - - // MARK: - Properties - - open override var itemType: ItemType { return .title } - - - // MARK: - Functions - - open override func applyAppearance(_ appearance: ActionSheetAppearance) { - self.appearance = ActionSheetTitleAppearance(copy: appearance.title) - } - - open override func applyAppearance(to cell: UITableViewCell) { - super.applyAppearance(to: cell) - cell.selectionStyle = .none - cell.textLabel?.textAlignment = .center - } -} diff --git a/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetDefaultPresenter.swift b/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetDefaultPresenter.swift deleted file mode 100755 index b140639b1..000000000 --- a/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetDefaultPresenter.swift +++ /dev/null @@ -1,151 +0,0 @@ -// -// ActionSheetDefaultPresenter.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-27. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This presenter will present action sheets as regular action - sheets, which means that it presents sheets from the bottom. - - */ - -import UIKit - -open class ActionSheetDefaultPresenter: ActionSheetPresenter { - - - // MARK: - Initialization - - public init() {} - - deinit { print("\(type(of: self)) deinit") } - - - // MARK: - Properties - - open var availablePresentationSize: CGSize { return UIScreen.main.bounds.size } - open var events = ActionSheetPresenterEvents() - open var isDismissableWithTapOnBackground = true - - private var actionSheet: ActionSheet? - private var actionSheetView: UIView? - private var backgroundColor = UIColor.black.withAlphaComponent(0.4) - private var backgroundView: UIView? - - - // MARK: - ActionSheetPresenter - - open func dismiss(completion: @escaping () -> ()) { - dismissActionSheet() - completion() - } - - open func present(sheet: ActionSheet, in vc: UIViewController, from view: UIView?) { - present(sheet: sheet, in: vc) - } - - open func present(sheet: ActionSheet, in vc: UIViewController, from item: UIBarButtonItem) { - present(sheet: sheet, in: vc) - } - - open func present(sheet: ActionSheet, in vc: UIViewController) { - actionSheet = sheet - addBackgroundView(to: vc.view) - addActionSheetView(from: sheet, to: vc.view) - presentBackgroundView() - presentActionSheet(sheet, in: vc.view) - } - - - // MARK: - Protected, overridable Functions - - open func addActionSheetView(from sheet: ActionSheet, to view: UIView) { - guard let sheetView = sheet.view else { return } - sheetView.frame.size.height = sheet.contentHeight - view.addSubview(sheetView) - actionSheetView = sheetView - } - - open func addBackgroundView(to view: UIView) { - let bgView = UIView(frame: view.frame) - bgView.autoresizingMask = [.flexibleWidth, .flexibleHeight] - addBackgroundViewTapAction(to: bgView) - view.addSubview(bgView) - bgView.backgroundColor = backgroundColor - backgroundView = bgView - } - - open func addBackgroundViewTapAction(to view: UIView) { - view.isUserInteractionEnabled = true - let action = #selector(backgroundViewTapAction) - let tap = UITapGestureRecognizer(target: self, action: action) - view.addGestureRecognizer(tap) - } - - open func animate(_ animation: @escaping () -> ()) { - animate(animation, completion: nil) - } - - open func animate(_ animation: @escaping () -> (), completion: (() -> ())?) { - UIView.animate(withDuration: 0.3, delay: 0, options: [.curveEaseOut], animations: animation) { _ in completion?() } - } - - open func dismissActionSheet() { - actionSheet = nil - removeActionSheetView() - removeBackgroundView() - } - - open func presentActionSheet(_ sheet: ActionSheet, in view: UIView) { - guard let sheetView = actionSheetView else { return } - sheetView.frame = presentationTransitionStartFrame(for: sheet, in: view) - animate { sheetView.frame = self.presentationFrame(for: sheet, in: view) ?? .zero } - sheetView.autoresizingMask = [.flexibleWidth, .flexibleTopMargin] - } - - open func presentationFrame(for sheet: ActionSheet, in view: UIView) -> CGRect? { - return sheet.bottomPresentationFrame - } - - open func presentationTransitionStartFrame(for sheet: ActionSheet, in view: UIView) -> CGRect { - var frame = presentationFrame(for: sheet, in: view) ?? .zero - frame.origin.y += 100 - return frame - } - - open func presentBackgroundView() { - guard let view = backgroundView else { return } - view.alpha = 0 - animate { view.alpha = 1 } - } - - open func removeActionSheetView() { - guard let view = actionSheetView else { return } - var frame = view.frame - frame.origin.y += frame.height + 100 - let animation = { view.frame = frame } - animate(animation) { view.removeFromSuperview() } - } - - open func removeBackgroundView() { - guard let view = backgroundView else { return } - let animation = { view.alpha = 0 } - animate(animation) { view.removeFromSuperview() } - } -} - - -// MARK: - Actions - -@objc public extension ActionSheetDefaultPresenter { - - public func backgroundViewTapAction() { - guard isDismissableWithTapOnBackground else { return } - events.didDismissWithBackgroundTap?() - dismissActionSheet() - } -} diff --git a/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetPopoverPresenter.swift b/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetPopoverPresenter.swift deleted file mode 100755 index 3697a302c..000000000 --- a/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetPopoverPresenter.swift +++ /dev/null @@ -1,112 +0,0 @@ -// -// ActionSheetPopoverPresenter.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This presenter will present action sheets as popovers, just - as regular UIAlertControllers are displayed on the iPad. It - should only be used when a sheet is displayed on an iPad. - - Since popovers have an arrow that should use the same color - as the rest of the popover view, this presenter will remove - any header view as well as combine items and buttons into a - single section. - - */ - -import UIKit - -open class ActionSheetPopoverPresenter: NSObject, ActionSheetPresenter { - - - // MARK: - Initialization - - deinit { print("\(type(of: self)) deinit") } - - - // MARK: - Properties - - open var availablePresentationSize: CGSize { return popover?.frameOfPresentedViewInContainerView.size ?? .zero } - open var events = ActionSheetPresenterEvents() - open var isDismissableWithTapOnBackground = true - - private var actionSheet: ActionSheet? - private var actionSheetView: UIView? - private var backgroundView: UIView? - private weak var popover: UIPopoverPresentationController? - - - // MARK: - ActionSheetPresenter - - public func dismiss(completion: @escaping () -> ()) { - let dismissAction = { completion(); self.actionSheet = nil } - let vc = actionSheet?.presentingViewController - vc?.dismiss(animated: true) { dismissAction() } ?? dismissAction() - } - - open func present(sheet: ActionSheet, in vc: UIViewController, from view: UIView?) { - popover = self.popover(for: sheet, in: vc) - popover?.sourceView = view - popover?.sourceRect = view?.bounds ?? CGRect() - popover?.delegate = self - vc.present(sheet, animated: true, completion: nil) - } - - open func present(sheet: ActionSheet, in vc: UIViewController, from item: UIBarButtonItem) { - popover = self.popover(for: sheet, in: vc) - popover?.barButtonItem = item - vc.present(sheet, animated: true, completion: nil) - } - - public func presentationFrame(for sheet: ActionSheet, in view: UIView) -> CGRect? { - return nil - } -} - - -// MARK: - UIPopoverPresentationControllerDelegate - -extension ActionSheetPopoverPresenter: UIPopoverPresentationControllerDelegate { - - public func popoverPresentationControllerShouldDismissPopover(_ controller: UIPopoverPresentationController) -> Bool { - guard isDismissableWithTapOnBackground else { return false } - events.didDismissWithBackgroundTap?() - dismiss {} - return false - } -} - - -// MARK: - Private Functions - -private extension ActionSheetPopoverPresenter { - - func popover(for sheet: ActionSheet, in vc: UIViewController) -> UIPopoverPresentationController? { - guard sheet.contentHeight > 0 else { return nil } - setupSheetForPresentation(sheet) - sheet.modalPresentationStyle = .popover - let popover = sheet.popoverPresentationController - popover?.backgroundColor = sheet.view.backgroundColor - popover?.delegate = vc as? UIPopoverPresentationControllerDelegate - return popover - } - - func popoverItems(for sheet: ActionSheet) -> [ActionSheetItem] { - let items: [ActionSheetItem] = sheet.items + sheet.buttons - return items.filter { !($0 is ActionSheetCancelButton) } - } - - func setupSheetForPresentation(_ sheet: ActionSheet) { - self.actionSheet = sheet - sheet.headerView = nil - sheet.items = popoverItems(for: sheet) - sheet.buttons = [] - sheet.preferredContentSize = sheet.preferredPopoverSize - sheet.view.backgroundColor = sheet.itemsView.backgroundColor - } -} diff --git a/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetPresenter.swift b/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetPresenter.swift deleted file mode 100755 index 6567a621f..000000000 --- a/Libraries external/Sheeeeeeeeet/Presenters/ActionSheetPresenter.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// ActionSheetPresenter.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-18. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - Action sheet presenters are used by Sheeeeeeeeet to present - action sheets in different ways, e.g. with a default bottom - slide, showing a popover from the tapped view etc. - - When implementing this protocol, `present(in:from:)` is the - standard way to present an action sheet, while `dismiss` is - the standard way to dismiss it. - - `isDismissableWithTapOnBackground` is used to specify if an - action sheet can be dismissed by tapping on the background. - - */ - -import Foundation - -public struct ActionSheetPresenterEvents { - - public init() {} - - public var didDismissWithBackgroundTap: (() -> ())? -} - -public protocol ActionSheetPresenter: AnyObject { - - var availablePresentationSize: CGSize { get } - var events: ActionSheetPresenterEvents { get set } - var isDismissableWithTapOnBackground: Bool { get set } - - func dismiss(completion: @escaping () -> ()) - func present(sheet: ActionSheet, in vc: UIViewController, from view: UIView?) - func present(sheet: ActionSheet, in vc: UIViewController, from item: UIBarButtonItem) - func presentationFrame(for sheet: ActionSheet, in view: UIView) -> CGRect? -} diff --git a/Libraries external/Sheeeeeeeeet/Sheeeeeeeeet.h b/Libraries external/Sheeeeeeeeet/Sheeeeeeeeet.h deleted file mode 100755 index 82d46984e..000000000 --- a/Libraries external/Sheeeeeeeeet/Sheeeeeeeeet.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Sheeeeeeeeet.h -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-18. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -#import <UIKit/UIKit.h> - -//! Project version number for Sheeeeeeeeet. -FOUNDATION_EXPORT double SheeeeeeeeetVersionNumber; - -//! Project version string for Sheeeeeeeeet. -FOUNDATION_EXPORT const unsigned char SheeeeeeeeetVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import <Sheeeeeeeeet/PublicHeader.h> - - diff --git a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemCell.swift b/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemCell.swift deleted file mode 100755 index fc8d0ff01..000000000 --- a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemCell.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation - -open class ActionSheetCollectionItemCell: ActionSheetItemCell { - - - // MARK: - Properties - - static var itemCellIdentifier: String { return "Cell" } - - static var nib: UINib = UINib(nibName: "ActionSheetCollectionItemCell", bundle: Bundle.init(for: ActionSheetCollectionItemCell.self)) - - - // MARK: - Outlets - - @IBOutlet weak var collectionView: UICollectionView! { - didSet { - let flow = UICollectionViewFlowLayout() - flow.scrollDirection = .horizontal - collectionView.collectionViewLayout = flow - } - } - - - // MARK: - Functions - - func setup(withNib nib: UINib, owner: UICollectionViewDataSource & UICollectionViewDelegate) { - let id = ActionSheetCollectionItemCell.itemCellIdentifier - collectionView.contentInset = .zero - collectionView.register(nib, forCellWithReuseIdentifier: id) - collectionView.dataSource = owner - collectionView.delegate = owner - collectionView.reloadData() - } -} diff --git a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemCell.xib b/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemCell.xib deleted file mode 100755 index 57179b468..000000000 --- a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemCell.xib +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> - <device id="retina4_7" orientation="portrait"> - <adaptation id="fullscreen"/> - </device> - <dependencies> - <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="196" id="moX-qQ-Gyn" customClass="ActionSheetCollectionItemCell" customModule="Sheeeeeeeeet" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="452" height="196"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="moX-qQ-Gyn" id="qre-fe-O26"> - <rect key="frame" x="0.0" y="0.0" width="452" height="195.5"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="eSV-yW-MpO"> - <rect key="frame" x="0.0" y="0.0" width="452" height="195.5"/> - <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="UCY-qV-avs"> - <size key="itemSize" width="50" height="50"/> - <size key="headerReferenceSize" width="0.0" height="0.0"/> - <size key="footerReferenceSize" width="0.0" height="0.0"/> - <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> - </collectionViewFlowLayout> - </collectionView> - </subviews> - <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> - <constraints> - <constraint firstAttribute="bottom" secondItem="eSV-yW-MpO" secondAttribute="bottom" id="Dnr-ur-bHp"/> - <constraint firstAttribute="trailing" secondItem="eSV-yW-MpO" secondAttribute="trailing" id="Hbt-ZB-Gy8"/> - <constraint firstItem="eSV-yW-MpO" firstAttribute="top" secondItem="qre-fe-O26" secondAttribute="top" id="OuY-7J-7R1"/> - <constraint firstItem="eSV-yW-MpO" firstAttribute="leading" secondItem="qre-fe-O26" secondAttribute="leading" id="h5Z-mf-v8W"/> - </constraints> - </tableViewCellContentView> - <connections> - <outlet property="collectionView" destination="eSV-yW-MpO" id="s1m-Z2-HwO"/> - </connections> - <point key="canvasLocation" x="-28" y="-15"/> - </tableViewCell> - </objects> -</document> diff --git a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemContentCell.swift b/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemContentCell.swift deleted file mode 100755 index 1744b2e70..000000000 --- a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCollectionItemContentCell.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ActionSheetCollectionItemContentCell.swift -// Sheeeeeeeeet -// -// Created by Jonas Ullström (ullstrm) on 2018-03-01. -// Copyright © 2018 Jonas Ullström. All rights reserved. -// - -/* - - This protocol must be implemented by any cell that is to be - used together with an `ActionSheetCollectionItem`. - - */ - -import UIKit - -public protocol ActionSheetCollectionItemContentCell where Self: UICollectionViewCell { - - static var nib: UINib { get } - static var defaultSize: CGSize { get } - static var leftInset: CGFloat { get } - static var rightInset: CGFloat { get } - static var topInset: CGFloat { get } - static var bottomInset: CGFloat { get } - static var itemSpacing: CGFloat { get } -} diff --git a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCustomItemCell.swift b/Libraries external/Sheeeeeeeeet/Views/ActionSheetCustomItemCell.swift deleted file mode 100755 index d1c1c5397..000000000 --- a/Libraries external/Sheeeeeeeeet/Views/ActionSheetCustomItemCell.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// ActionSheetCustomItemCell.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2018-10-08. -// Copyright © 2018 Daniel Saidi. All rights reserved. -// - -/* - - This protocol must be implemented by any cell that is to be - used together with an `ActionSheetCustomItem`. - - */ - -import UIKit - -public protocol ActionSheetCustomItemCell where Self: ActionSheetItemCell { - - static var nib: UINib { get } - static var defaultSize: CGSize { get } -} diff --git a/Libraries external/Sheeeeeeeeet/Views/ActionSheetItemCell.swift b/Libraries external/Sheeeeeeeeet/Views/ActionSheetItemCell.swift deleted file mode 100755 index 3e94b2da9..000000000 --- a/Libraries external/Sheeeeeeeeet/Views/ActionSheetItemCell.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// ActionSheetItemCell.swift -// Sheeeeeeeeet -// -// Created by Daniel Saidi on 2017-11-24. -// Copyright © 2017 Daniel Saidi. All rights reserved. -// - -/* - - This is the base class for all different cell types in this - library. It makes it possible to set a global appearance on - all item cells in an app. - - */ - -import UIKit - -open class ActionSheetItemCell: UITableViewCell {} |