Skip to content

Commit

Permalink
Remove NSError dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
azonov committed Feb 22, 2019
1 parent ef014bf commit 30f7da7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Example/ExpandableCell.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ExpandableCell/Pods-ExpandableCell-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-ExpandableCell/Pods-ExpandableCell-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AZExpandable/AZExpandable.framework",
);
name = "[CP] Embed Pods Frameworks";
Expand All @@ -249,7 +249,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ExpandableCell/Pods-ExpandableCell-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ExpandableCell/Pods-ExpandableCell-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
12 changes: 6 additions & 6 deletions Source/ExpandableTable/PagingTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public typealias NextPageClosure = (PagingTable) -> ()

public class PagingTable: NSObject {

public enum PagingError: Error {
case described(string: String)
}

// MARK: Private Properties
private var proxy: ExpandableProxy?
private var loadMoreIndexPath: IndexPath?
Expand Down Expand Up @@ -43,17 +47,13 @@ public class PagingTable: NSObject {
let sectionsCount = tableView.numberOfSections

guard sectionsCount > 0 else {
throw NSError(domain: "ExpandableTable",
code: 0,
userInfo: ["error" : "numberOfSections > 0"])
throw PagingError.described(string: "numberOfSections > 0")
}

let rowsCount = tableView.numberOfRows(inSection: sectionsCount - 1)

guard rowsCount > 0 else {
throw NSError(domain: "ExpandableTable",
code: 0,
userInfo: ["error" : "rowsCount > 0"])
throw PagingError.described(string: "rowsCount > 0")
}

var indexPath = IndexPath(item: rowsCount - 1,
Expand Down

0 comments on commit 30f7da7

Please sign in to comment.