Skip to content

Commit

Permalink
Fix Xcode 14 warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTelezhkin committed Jun 22, 2022
1 parent 7f9b5ee commit 4443040
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 153 deletions.
5 changes: 3 additions & 2 deletions DTTableViewManager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -652,7 +652,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 1310;
LastUpgradeCheck = 1400;
ORGANIZATIONNAME = "Denys Telezhkin";
TargetAttributes = {
9A2A38BB1AEE285E0021E97D = {
Expand Down Expand Up @@ -750,6 +750,7 @@
/* Begin PBXShellScriptBuildPhase section */
9A0205CF1FD44AF6009D9A63 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
{
"object": {
"pins": [
{
"package": "Changeset",
"repositoryURL": "https://github.com/DenTelezhkin/Changeset",
"state": {
"branch": "swiftpm-platforms",
"revision": "76ee0cdc4f46a5129229e36530384e1bee7d34e5",
"version": null
}
},
{
"package": "DTModelStorage",
"repositoryURL": "https://github.com/DenTelezhkin/DTModelStorage",
"state": {
"branch": null,
"revision": "d00f7567859a925470720b0b6fd01d791df8b51d",
"version": "10.0.0"
}
"pins" : [
{
"identity" : "changeset",
"kind" : "remoteSourceControl",
"location" : "https://github.com/DenTelezhkin/Changeset",
"state" : {
"branch" : "swiftpm-platforms",
"revision" : "76ee0cdc4f46a5129229e36530384e1bee7d34e5"
}
]
},
"version": 1
},
{
"identity" : "dtmodelstorage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/DenTelezhkin/DTModelStorage",
"state" : {
"revision" : "d00f7567859a925470720b0b6fd01d791df8b51d",
"version" : "10.0.0"
}
}
],
"version" : 2
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
24 changes: 12 additions & 12 deletions Sources/DTTableViewManager/DTTableViewManager+DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,70 +27,70 @@ import Foundation
import UIKit
import DTModelStorage

extension DTTableViewManager
public extension DTTableViewManager
{
/// Registers `closure` to be executed, when `UITableViewDelegate.tableView(_:canMoveRowAt:)` method is called for `cellClass`.
open func canMove<Cell:ModelTransfer>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell: UITableViewCell {
func canMove<Cell:ModelTransfer>(_ cellClass: Cell.Type, _ closure: @escaping (Cell, Cell.ModelType, IndexPath) -> Bool) where Cell: UITableViewCell {
tableDataSource?.appendReaction(for: Cell.self, signature: EventMethodSignature.canMoveRowAtIndexPath, closure: closure)
}

/// Registers `closure` to be executed, when `UITableViewDelegate.tableView(_:moveRowAt:to:)` method is called for `cellClass`.
/// - warning: This method requires items to be moved without animations, since animation has already happened when user moved those cells. If you use `MemoryStorage`, it's appropriate to call `memoryStorage.moveItemWithoutAnimation(from:to:)` method to achieve desired behavior.
/// - SeeAlso: 'tableView:moveRowAt:to:' method
open func move<Cell:ModelTransfer>(_ cellClass: Cell.Type, _ closure: @escaping (_ destinationIndexPath: IndexPath, Cell, Cell.ModelType, _ sourceIndexPath: IndexPath) -> Void) where Cell: UITableViewCell {
func move<Cell:ModelTransfer>(_ cellClass: Cell.Type, _ closure: @escaping (_ destinationIndexPath: IndexPath, Cell, Cell.ModelType, _ sourceIndexPath: IndexPath) -> Void) where Cell: UITableViewCell {
tableDataSource?.append4ArgumentReaction(for: Cell.self,
signature: .moveRowAtIndexPathToIndexPath,
closure: closure)
}

#if os(iOS)
/// Registers `closure` to be executed, when `UITableViewDataSource.sectionIndexTitles(for:_) ` method is called.
open func sectionIndexTitles(_ closure: @escaping () -> [String]?) {
func sectionIndexTitles(_ closure: @escaping () -> [String]?) {
tableDataSource?.appendNonCellReaction(.sectionIndexTitlesForTableView, closure: closure)
}

/// Registers `closure` to be executed, when `UITableViewDataSource.tableView(_:sectionForSectionIndexTitle:at:)` method is called.
open func sectionForSectionIndexTitle(_ closure: @escaping (String, Int) -> Int) {
func sectionForSectionIndexTitle(_ closure: @escaping (String, Int) -> Int) {
tableDataSource?.appendNonCellReaction(.sectionForSectionIndexTitleAtIndex, closure: closure)
}
#endif

/// Registers `closure` to be executed, when `UITableViewDelegate.tableView(_:commitEditingStyle:forRowAt:)` method is called for `cellClass`.
open func commitEditingStyle<Cell:ModelTransfer>(for cellClass: Cell.Type, _ closure: @escaping (UITableViewCell.EditingStyle, Cell, Cell.ModelType, IndexPath) -> Void) where Cell: UITableViewCell {
func commitEditingStyle<Cell:ModelTransfer>(for cellClass: Cell.Type, _ closure: @escaping (UITableViewCell.EditingStyle, Cell, Cell.ModelType, IndexPath) -> Void) where Cell: UITableViewCell {
tableDataSource?.append4ArgumentReaction(for: Cell.self,
signature: .commitEditingStyleForRowAtIndexPath,
closure: closure)
}

/// Registers `closure` to be executed in `UITableViewDelegate.tableView(_:canEditCellForRowAt:)` method, when it's called for cell which model is of `itemType`.
open func canEditCell<Model>(withItem itemType: Model.Type, _ closure: @escaping (Model, IndexPath) -> Bool) {
func canEditCell<Model>(withItem itemType: Model.Type, _ closure: @escaping (Model, IndexPath) -> Bool) {
tableDataSource?.appendReaction(viewType: .cell, for: Model.self, signature: EventMethodSignature.canEditRowAtIndexPath, closure: closure)
}
}

extension ViewModelMapping where View: UITableViewCell {
public extension ViewModelMapping where View: UITableViewCell {
/// Registers `closure` to be executed, when `UITableViewDelegate.tableView(_:canMoveRowAt:)` method is called.
open func canMove(_ closure: @escaping (View, Model, IndexPath) -> Bool) {
func canMove(_ closure: @escaping (View, Model, IndexPath) -> Bool) {
reactions.append(EventReaction(viewType: View.self, modelType: Model.self, signature: EventMethodSignature.canMoveRowAtIndexPath.rawValue, closure))
}

/// Registers `closure` to be executed, when `UITableViewDelegate.tableView(_:moveRowAt:to:)` method is called.
/// - warning: This method requires items to be moved without animations, since animation has already happened when user moved those cells. If you use `MemoryStorage`, it's appropriate to call `memoryStorage.moveItemWithoutAnimation(from:to:)` method to achieve desired behavior.
/// - SeeAlso: 'tableView:moveRowAt:to:' method
open func moveRowTo(_ closure: @escaping (_ destinationIndexPath: IndexPath, View, Model, _ sourceIndexPath: IndexPath) -> Void) {
func moveRowTo(_ closure: @escaping (_ destinationIndexPath: IndexPath, View, Model, _ sourceIndexPath: IndexPath) -> Void) {
reactions.append(FourArgumentsEventReaction(View.self, modelType: Model.self, argument: IndexPath.self, signature: EventMethodSignature.moveRowAtIndexPathToIndexPath.rawValue, closure))
}

/// Registers `closure` to be executed, when `UITableViewDelegate.tableView(_:commitEditingStyle:forRowAt:)` method is called.
open func commitEditingStyle(_ closure: @escaping (UITableViewCell.EditingStyle, View, Model, IndexPath) -> Void) {
func commitEditingStyle(_ closure: @escaping (UITableViewCell.EditingStyle, View, Model, IndexPath) -> Void) {
reactions.append(FourArgumentsEventReaction(View.self, modelType: Model.self,
argument: UITableViewCell.EditingStyle.self,
signature: EventMethodSignature.commitEditingStyleForRowAtIndexPath.rawValue,
closure))
}

/// Registers `closure` to be executed in `UITableViewDelegate.tableView(_:canEditCellForRowAt:)` method, when it's called.
open func canEditCell(_ closure: @escaping (Model, IndexPath) -> Bool) {
func canEditCell(_ closure: @escaping (Model, IndexPath) -> Bool) {
reactions.append(EventReaction(modelType: Model.self, signature: EventMethodSignature.canEditRowAtIndexPath.rawValue, closure))
}
}
Loading

0 comments on commit 4443040

Please sign in to comment.