Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control to prevent overriding tableFooterView #20

Merged
merged 2 commits into from Sep 26, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Demo/Podfile.lock
@@ -1,5 +1,5 @@
PODS:
- StatefulTableView (0.1.4)
- StatefulTableView (0.1.5)

DEPENDENCIES:
- StatefulTableView (from `../`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
StatefulTableView: 31a08309d9ccf3e9cb55874cbdcf596bdc5fbb93
StatefulTableView: beb8d7fbe3e3bca782e51bd098245a0db8e09fd2

PODFILE CHECKSUM: e6944d74483536f64ec788f95fbe36a46c8b7346

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -64,7 +64,7 @@ func statefulTableViewLoadMoreErrorView(tvc: StatefulTableView, forLoadMoreError
Add this to your Podfile.

```ruby
pod 'StatefulTableView', '0.1.4'
pod 'StatefulTableView', '0.1.5'
```

## Contibuting
Expand Down
2 changes: 2 additions & 0 deletions Sources/StatefulTableView+LoadMore.swift
Expand Up @@ -33,6 +33,8 @@ extension StatefulTableView {
}

internal func updateLoadMoreView() {
guard !preventTableFooterViewOverriding else { return }

if watchForLoadMore || lastLoadMoreError != nil {
tableView.tableFooterView = viewForLoadingMore(withError: (loadMoreViewIsErrorView ? lastLoadMoreError : nil))
} else {
Expand Down
5 changes: 5 additions & 0 deletions Sources/StatefulTableView.swift
Expand Up @@ -132,6 +132,11 @@ public final class StatefulTableView: UIView {
The pluralized name of the items to be displayed. This will be used when the table is empty and no error view has been provided.
*/
public var pluralType = "records"

/**
Prevents the tableview to add loading more views to the footer, allowing the user to use a custom table footer view.
*/
public var preventTableFooterViewOverriding = false

internal var loadMoreViewIsErrorView = false
internal var lastLoadMoreError: NSError?
Expand Down
2 changes: 1 addition & 1 deletion StatefulTableView.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'StatefulTableView'
s.version = '0.1.4'
s.version = '0.1.5'
s.license = {
:type => 'MIT',
:file => 'LICENSE'
Expand Down