Skip to content
This repository was archived by the owner on Nov 15, 2020. It is now read-only.

Commit b94aa25

Browse files
committed
Swift 4.0 fixes
1 parent f06eee1 commit b94aa25

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

FlowKit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@
753753
PRODUCT_BUNDLE_IDENTIFIER = com.flowkit.demoapp;
754754
PRODUCT_NAME = "$(TARGET_NAME)";
755755
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
756-
SWIFT_VERSION = 4.2;
756+
SWIFT_VERSION = 4.0;
757757
TARGETED_DEVICE_FAMILY = "1,2";
758758
};
759759
name = Debug;
@@ -780,7 +780,7 @@
780780
PRODUCT_BUNDLE_IDENTIFIER = com.flowkit.demoapp;
781781
PRODUCT_NAME = "$(TARGET_NAME)";
782782
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
783-
SWIFT_VERSION = 4.2;
783+
SWIFT_VERSION = 4.0;
784784
TARGETED_DEVICE_FAMILY = "1,2";
785785
};
786786
name = Release;

FlowKitManager.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "FlowKitManager"
3-
s.version = "0.6.1"
3+
s.version = "0.6.0"
44
s.summary = "Declarative and type-safe UITableView & UICollectionView; a new way to work with tables and collections"
55
s.description = <<-DESC
66
Efficient, declarative and type-safe approach to create and manage UITableView and UICollectionView with built-in animation support.
@@ -13,5 +13,5 @@ Pod::Spec.new do |s|
1313
s.source = { :git => "https://github.com/malcommac/FlowKit.git", :tag => s.version.to_s }
1414
s.source_files = "Sources/**/*"
1515
s.frameworks = "Foundation"
16-
s.swift_version = "4.2"
16+
s.swift_version = "4.0"
1717
end

Sources/FlowKit/Collection/CollectionDirector.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,11 @@ public extension CollectionDirector {
502502
var identifier: String!
503503

504504
switch kind {
505-
case UICollectionView.elementKindSectionHeader:
505+
case UICollectionElementKindSectionHeader:
506506
guard let header = section.header else { return UICollectionReusableView() }
507507
identifier = self.reusableRegister.registerHeaderFooter(header, type: kind)
508508

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

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

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

541541
switch elementKind {
542-
case UICollectionView.elementKindSectionHeader:
542+
case UICollectionElementKindSectionHeader:
543543
let header = (sections[indexPath.section].header as? AbstractCollectionHeaderFooterItem)
544544
let _ = header?.dispatch(.endDisplay, type: .header, view: view, section: indexPath.section, collection: collectionView)
545545
self.on.endDisplayHeader?( (view,indexPath,collectionView) )
546-
case UICollectionView.elementKindSectionFooter:
546+
case UICollectionElementKindSectionFooter:
547547
let footer = (sections[indexPath.section].footer as? AbstractCollectionHeaderFooterItem)
548548
let _ = footer?.dispatch(.endDisplay, type: .footer, view: view, section: indexPath.section, collection: collectionView)
549549
self.on.endDisplayFooter?( (view,indexPath,collectionView) )
@@ -697,8 +697,8 @@ public extension CollectionDirector {
697697
@discardableResult
698698
internal func registerHeaderFooter(_ headerFooter: CollectionSectionProtocol, type: String) -> String {
699699
let identifier = headerFooter.reuseIdentifier
700-
if (type == UICollectionView.elementKindSectionHeader && self.headerIDs.contains(identifier)) ||
701-
(type == UICollectionView.elementKindSectionFooter && self.footerIDs.contains(identifier)) {
700+
if (type == UICollectionElementKindSectionHeader && self.headerIDs.contains(identifier)) ||
701+
(type == UICollectionElementKindSectionFooter && self.footerIDs.contains(identifier)) {
702702
return identifier
703703
}
704704

Sources/FlowKit/Collection/FlowCollectionDirector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ open class FlowCollectionDirector: CollectionDirector, UICollectionViewDelegateF
8787

8888
/// Set the section reference starting point.
8989
@available(iOS 11.0, *)
90-
public var sectionInsetReference: UICollectionViewFlowLayout.SectionInsetReference {
90+
public var sectionInsetReference: UICollectionViewFlowLayoutSectionInsetReference {
9191
set { self.layout?.sectionInsetReference = newValue }
9292
get { return self.layout!.sectionInsetReference }
9393
}

Sources/FlowKit/Table/TableAdapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ open class TableAdapter<M: ModelProtocol, C: CellProtocol>: TableAdapterProtocol
8080

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

8585
case .canMoveRow:
8686
guard let callback = self.on.canMoveRow else { return nil }

Sources/FlowKit/Table/TableDirector+Events.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public extension TableAdapter {
7272
public var dequeue : ((EventContext) -> (Void))? = nil
7373

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

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

9898
public var willBeginEdit: ((EventContext) -> Void)? = nil
9999
public var didEndEdit: ((EventContext) -> Void)? = nil
100-
public var editStyle: ((EventContext) -> UITableViewCell.EditingStyle)? = nil
100+
public var editStyle: ((EventContext) -> UITableViewCellEditingStyle)? = nil
101101
public var deleteConfirmTitle: ((EventContext) -> String?)? = nil
102102
public var editShouldIndent: ((EventContext) -> Bool)? = nil
103103

Sources/FlowKit/Table/TableDirector+Support.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public enum TableSelectionState {
6363
/// Animations used with reload
6464
public struct TableReloadAnimations {
6565

66-
public var rowDeletionAnimation: UITableView.RowAnimation = .automatic
67-
public var rowInsertionAnimation: UITableView.RowAnimation = .automatic
68-
public var rowReloadAnimation: UITableView.RowAnimation = .automatic
66+
public var rowDeletionAnimation: UITableViewRowAnimation = .automatic
67+
public var rowInsertionAnimation: UITableViewRowAnimation = .automatic
68+
public var rowReloadAnimation: UITableViewRowAnimation = .automatic
6969

70-
public var sectionDeletionAnimation: UITableView.RowAnimation = .automatic
71-
public var sectionInsertionAnimation: UITableView.RowAnimation = .automatic
72-
public var sectionReloadAnimation: UITableView.RowAnimation = .automatic
70+
public var sectionDeletionAnimation: UITableViewRowAnimation = .automatic
71+
public var sectionInsertionAnimation: UITableViewRowAnimation = .automatic
72+
public var sectionReloadAnimation: UITableViewRowAnimation = .automatic
7373

7474
public init() { }
7575

Sources/FlowKit/Table/TableDirector.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ public class TableDirector: NSObject, UITableViewDelegate, UITableViewDataSource
8080
self.tableView?.rowHeight = h
8181
self.tableView?.estimatedRowHeight = h
8282
case .autoLayout(let estimate):
83-
self.tableView?.rowHeight = UITableView.automaticDimension
83+
self.tableView?.rowHeight = UITableViewAutomaticDimension
8484
self.tableView?.estimatedRowHeight = estimate
8585
case .default:
86-
self.tableView?.rowHeight = UITableView.automaticDimension
87-
self.tableView?.estimatedRowHeight = UITableView.automaticDimension
86+
self.tableView?.rowHeight = UITableViewAutomaticDimension
87+
self.tableView?.estimatedRowHeight = UITableViewAutomaticDimension
8888
}
8989
}
9090
}
@@ -428,15 +428,15 @@ public extension TableDirector {
428428
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
429429
let item = (self.sections[section].headerView as? AbstractTableHeaderFooterItem)
430430
guard let height = item?.dispatch(.height, type: .header, view: nil, section: section, table: tableView) as? CGFloat else {
431-
return (self.headerHeight ?? UITableView.automaticDimension)
431+
return (self.headerHeight ?? UITableViewAutomaticDimension)
432432
}
433433
return height
434434
}
435435

436436
public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
437437
let item = (self.sections[section].footerView as? AbstractTableHeaderFooterItem)
438438
guard let height = item?.dispatch(.height, type: .footer, view: nil, section: section, table: tableView) as? CGFloat else {
439-
return (self.footerHeight ?? UITableView.automaticDimension)
439+
return (self.footerHeight ?? UITableViewAutomaticDimension)
440440
}
441441
return height
442442
}
@@ -445,7 +445,7 @@ public extension TableDirector {
445445
let item = (self.sections[section].headerView as? AbstractTableHeaderFooterItem)
446446
guard let estHeight = item?.dispatch(.estimatedHeight, type: .header, view: nil, section: section, table: tableView) as? CGFloat else {
447447
guard let height = item?.dispatch(.height, type: .header, view: nil, section: section, table: tableView) as? CGFloat else {
448-
return (self.headerHeight ?? UITableView.automaticDimension)
448+
return (self.headerHeight ?? UITableViewAutomaticDimension)
449449
}
450450
return height
451451
}
@@ -456,7 +456,7 @@ public extension TableDirector {
456456
let item = (self.sections[section].footerView as? AbstractTableHeaderFooterItem)
457457
guard let height = item?.dispatch(.estimatedHeight,type: .footer, view: nil, section: section, table: tableView) as? CGFloat else {
458458
guard let height = item?.dispatch(.height, type: .footer, view: nil, section: section, table: tableView) as? CGFloat else {
459-
return (self.footerHeight ?? UITableView.automaticDimension)
459+
return (self.footerHeight ?? UITableViewAutomaticDimension)
460460
}
461461
return height
462462
}
@@ -491,7 +491,7 @@ public extension TableDirector {
491491

492492
// Inserting or Deleting Table Rows
493493

494-
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
494+
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
495495
let (model,adapter) = self.context(forItemAt: indexPath)
496496
adapter.dispatch(.commitEdit, context: InternalContext(model, indexPath, nil, tableView, param1: editingStyle))
497497
}
@@ -521,17 +521,17 @@ public extension TableDirector {
521521
switch self.rowHeight {
522522
case .default:
523523
let (model,adapter) = self.context(forItemAt: indexPath)
524-
return (adapter.dispatch(.rowHeight, context: InternalContext(model, indexPath, nil, tableView)) as? CGFloat) ?? UITableView.automaticDimension
524+
return (adapter.dispatch(.rowHeight, context: InternalContext(model, indexPath, nil, tableView)) as? CGFloat) ?? UITableViewAutomaticDimension
525525
case .autoLayout(_):
526-
return UITableView.automaticDimension
526+
return UITableViewAutomaticDimension
527527
default:
528528
return self.tableView!.rowHeight
529529
}
530530
}
531531

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

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

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

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

0 commit comments

Comments
 (0)