Skip to content
This repository was archived by the owner on Nov 15, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FlowKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.flowkit.demoapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -780,7 +780,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.flowkit.demoapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion FlowKitManager.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/malcommac/FlowKit.git", :tag => s.version.to_s }
s.source_files = "Sources/**/*"
s.frameworks = "Foundation"
s.swift_version = "4.0"
s.swift_version = "4.2"
end
16 changes: 8 additions & 8 deletions Sources/FlowKit/Collection/CollectionDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,11 @@ public extension CollectionDirector {
var identifier: String!

switch kind {
case UICollectionElementKindSectionHeader:
case UICollectionView.elementKindSectionHeader:
guard let header = section.header else { return UICollectionReusableView() }
identifier = self.reusableRegister.registerHeaderFooter(header, type: kind)

case UICollectionElementKindSectionFooter:
case UICollectionView.elementKindSectionFooter:
guard let footer = section.footer else { return UICollectionReusableView() }
identifier = self.reusableRegister.registerHeaderFooter(footer, type: kind)

Expand All @@ -522,11 +522,11 @@ public extension CollectionDirector {
public func collectionView(_ collectionView: UICollectionView, willDisplaySupplementaryView view: UICollectionReusableView, forElementKind elementKind: String, at indexPath: IndexPath) {

switch elementKind {
case UICollectionElementKindSectionHeader:
case UICollectionView.elementKindSectionHeader:
let header = (sections[indexPath.section].header as? AbstractCollectionHeaderFooterItem)
let _ = header?.dispatch(.willDisplay, type: .header, view: view, section: indexPath.section, collection: collectionView)
self.on.willDisplayHeader?( (view,indexPath,collectionView) )
case UICollectionElementKindSectionFooter:
case UICollectionView.elementKindSectionFooter:
let footer = (sections[indexPath.section].footer as? AbstractCollectionHeaderFooterItem)
let _ = footer?.dispatch(.willDisplay, type: .footer, view: view, section: indexPath.section, collection: collectionView)
self.on.willDisplayFooter?( (view,indexPath,collectionView) )
Expand All @@ -539,11 +539,11 @@ public extension CollectionDirector {
public func collectionView(_ collectionView: UICollectionView, didEndDisplayingSupplementaryView view: UICollectionReusableView, forElementOfKind elementKind: String, at indexPath: IndexPath) {

switch elementKind {
case UICollectionElementKindSectionHeader:
case UICollectionView.elementKindSectionHeader:
let header = (sections[indexPath.section].header as? AbstractCollectionHeaderFooterItem)
let _ = header?.dispatch(.endDisplay, type: .header, view: view, section: indexPath.section, collection: collectionView)
self.on.endDisplayHeader?( (view,indexPath,collectionView) )
case UICollectionElementKindSectionFooter:
case UICollectionView.elementKindSectionFooter:
let footer = (sections[indexPath.section].footer as? AbstractCollectionHeaderFooterItem)
let _ = footer?.dispatch(.endDisplay, type: .footer, view: view, section: indexPath.section, collection: collectionView)
self.on.endDisplayFooter?( (view,indexPath,collectionView) )
Expand Down Expand Up @@ -697,8 +697,8 @@ public extension CollectionDirector {
@discardableResult
internal func registerHeaderFooter(_ headerFooter: CollectionSectionProtocol, type: String) -> String {
let identifier = headerFooter.reuseIdentifier
if (type == UICollectionElementKindSectionHeader && self.headerIDs.contains(identifier)) ||
(type == UICollectionElementKindSectionFooter && self.footerIDs.contains(identifier)) {
if (type == UICollectionView.elementKindSectionHeader && self.headerIDs.contains(identifier)) ||
(type == UICollectionView.elementKindSectionFooter && self.footerIDs.contains(identifier)) {
return identifier
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/FlowKit/Collection/FlowCollectionDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ open class FlowCollectionDirector: CollectionDirector, UICollectionViewDelegateF

/// Set the section reference starting point.
@available(iOS 11.0, *)
public var sectionInsetReference: UICollectionViewFlowLayoutSectionInsetReference {
public var sectionInsetReference: UICollectionViewFlowLayout.SectionInsetReference {
set { self.layout?.sectionInsetReference = newValue }
get { return self.layout!.sectionInsetReference }
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/FlowKit/Table/TableAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ open class TableAdapter<M: ModelProtocol, C: CellProtocol>: TableAdapterProtocol

case .commitEdit:
guard let callback = self.on.commitEdit else { return nil }
return callback(Context<M,C>(generic: context), (context.param1 as! UITableViewCellEditingStyle))
return callback(Context<M,C>(generic: context), (context.param1 as! UITableViewCell.EditingStyle))

case .canMoveRow:
guard let callback = self.on.canMoveRow else { return nil }
Expand Down
4 changes: 2 additions & 2 deletions Sources/FlowKit/Table/TableDirector+Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public extension TableAdapter {
public var dequeue : ((EventContext) -> (Void))? = nil

public var canEdit: ((EventContext) -> Bool)? = nil
public var commitEdit: ((_ ctx: EventContext, _ commit: UITableViewCellEditingStyle) -> Void)? = nil
public var commitEdit: ((_ ctx: EventContext, _ commit: UITableViewCell.EditingStyle) -> Void)? = nil

public var canMoveRow: ((EventContext) -> Bool)? = nil
public var moveRow: ((_ ctx: EventContext, _ dest: IndexPath) -> Void)? = nil
Expand All @@ -97,7 +97,7 @@ public extension TableAdapter {

public var willBeginEdit: ((EventContext) -> Void)? = nil
public var didEndEdit: ((EventContext) -> Void)? = nil
public var editStyle: ((EventContext) -> UITableViewCellEditingStyle)? = nil
public var editStyle: ((EventContext) -> UITableViewCell.EditingStyle)? = nil
public var deleteConfirmTitle: ((EventContext) -> String?)? = nil
public var editShouldIndent: ((EventContext) -> Bool)? = nil

Expand Down
12 changes: 6 additions & 6 deletions Sources/FlowKit/Table/TableDirector+Support.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public enum TableSelectionState {
/// Animations used with reload
public struct TableReloadAnimations {

public var rowDeletionAnimation: UITableViewRowAnimation = .automatic
public var rowInsertionAnimation: UITableViewRowAnimation = .automatic
public var rowReloadAnimation: UITableViewRowAnimation = .automatic
public var rowDeletionAnimation: UITableView.RowAnimation = .automatic
public var rowInsertionAnimation: UITableView.RowAnimation = .automatic
public var rowReloadAnimation: UITableView.RowAnimation = .automatic

public var sectionDeletionAnimation: UITableViewRowAnimation = .automatic
public var sectionInsertionAnimation: UITableViewRowAnimation = .automatic
public var sectionReloadAnimation: UITableViewRowAnimation = .automatic
public var sectionDeletionAnimation: UITableView.RowAnimation = .automatic
public var sectionInsertionAnimation: UITableView.RowAnimation = .automatic
public var sectionReloadAnimation: UITableView.RowAnimation = .automatic

public init() { }

Expand Down
26 changes: 13 additions & 13 deletions Sources/FlowKit/Table/TableDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public class TableDirector: NSObject, UITableViewDelegate, UITableViewDataSource
self.tableView?.rowHeight = h
self.tableView?.estimatedRowHeight = h
case .autoLayout(let estimate):
self.tableView?.rowHeight = UITableViewAutomaticDimension
self.tableView?.rowHeight = UITableView.automaticDimension
self.tableView?.estimatedRowHeight = estimate
case .default:
self.tableView?.rowHeight = UITableViewAutomaticDimension
self.tableView?.estimatedRowHeight = UITableViewAutomaticDimension
self.tableView?.rowHeight = UITableView.automaticDimension
self.tableView?.estimatedRowHeight = UITableView.automaticDimension
}
}
}
Expand Down Expand Up @@ -428,15 +428,15 @@ public extension TableDirector {
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
let item = (self.sections[section].headerView as? AbstractTableHeaderFooterItem)
guard let height = item?.dispatch(.height, type: .header, view: nil, section: section, table: tableView) as? CGFloat else {
return (self.headerHeight ?? UITableViewAutomaticDimension)
return (self.headerHeight ?? UITableView.automaticDimension)
}
return height
}

public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
let item = (self.sections[section].footerView as? AbstractTableHeaderFooterItem)
guard let height = item?.dispatch(.height, type: .footer, view: nil, section: section, table: tableView) as? CGFloat else {
return (self.footerHeight ?? UITableViewAutomaticDimension)
return (self.footerHeight ?? UITableView.automaticDimension)
}
return height
}
Expand All @@ -445,7 +445,7 @@ public extension TableDirector {
let item = (self.sections[section].headerView as? AbstractTableHeaderFooterItem)
guard let estHeight = item?.dispatch(.estimatedHeight, type: .header, view: nil, section: section, table: tableView) as? CGFloat else {
guard let height = item?.dispatch(.height, type: .header, view: nil, section: section, table: tableView) as? CGFloat else {
return (self.headerHeight ?? UITableViewAutomaticDimension)
return (self.headerHeight ?? UITableView.automaticDimension)
}
return height
}
Expand All @@ -456,7 +456,7 @@ public extension TableDirector {
let item = (self.sections[section].footerView as? AbstractTableHeaderFooterItem)
guard let height = item?.dispatch(.estimatedHeight,type: .footer, view: nil, section: section, table: tableView) as? CGFloat else {
guard let height = item?.dispatch(.height, type: .footer, view: nil, section: section, table: tableView) as? CGFloat else {
return (self.footerHeight ?? UITableViewAutomaticDimension)
return (self.footerHeight ?? UITableView.automaticDimension)
}
return height
}
Expand Down Expand Up @@ -491,7 +491,7 @@ public extension TableDirector {

// Inserting or Deleting Table Rows

public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
let (model,adapter) = self.context(forItemAt: indexPath)
adapter.dispatch(.commitEdit, context: InternalContext(model, indexPath, nil, tableView, param1: editingStyle))
}
Expand Down Expand Up @@ -521,17 +521,17 @@ public extension TableDirector {
switch self.rowHeight {
case .default:
let (model,adapter) = self.context(forItemAt: indexPath)
return (adapter.dispatch(.rowHeight, context: InternalContext(model, indexPath, nil, tableView)) as? CGFloat) ?? UITableViewAutomaticDimension
return (adapter.dispatch(.rowHeight, context: InternalContext(model, indexPath, nil, tableView)) as? CGFloat) ?? UITableView.automaticDimension
case .autoLayout(_):
return UITableViewAutomaticDimension
return UITableView.automaticDimension
default:
return self.tableView!.rowHeight
}
}

public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
let (model,adapter) = self.context(forItemAt: indexPath)
return ((adapter.dispatch(.rowHeightEstimated, context: InternalContext(model, indexPath, nil, tableView)) as? CGFloat) ?? UITableViewAutomaticDimension)
return ((adapter.dispatch(.rowHeightEstimated, context: InternalContext(model, indexPath, nil, tableView)) as? CGFloat) ?? UITableView.automaticDimension)
}

public func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
Expand Down Expand Up @@ -597,9 +597,9 @@ public extension TableDirector {
adapter.dispatch(.didEndEdit, context: InternalContext(model, indexPath!, nil, tableView))
}

public func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
public func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
let (model,adapter) = self.context(forItemAt: indexPath)
return ((adapter.dispatch(.editStyle, context: InternalContext(model, indexPath, nil, tableView)) as? UITableViewCellEditingStyle) ?? .none)
return ((adapter.dispatch(.editStyle, context: InternalContext(model, indexPath, nil, tableView)) as? UITableViewCell.EditingStyle) ?? .none)
}

public func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {
Expand Down