From c6714fa9092dc0f599d8e186f420968c9357501c Mon Sep 17 00:00:00 2001 From: Jorge Ovalle Date: Thu, 1 Aug 2019 16:10:52 -0500 Subject: [PATCH] rename delegate function --- Example/Tests/DelegateTests.swift | 16 ++++++++-------- .../UICollectionView+WLEmptyState.swift | 2 +- .../Extensions/UITableView+WLEmptyState.swift | 2 +- WLEmptyState/Classes/Misc/DefaultConstants.swift | 2 +- .../Classes/Protocols/WLEmptyStateDelegate.swift | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Example/Tests/DelegateTests.swift b/Example/Tests/DelegateTests.swift index 1a614e2..c4e9993 100644 --- a/Example/Tests/DelegateTests.swift +++ b/Example/Tests/DelegateTests.swift @@ -19,30 +19,30 @@ class DelegateTests: XCTestCase { func testShouldScrollDelegatePropertyOnTableDefault() { let defaultTableViewController = DefaultTableViewController() - let shouldScrollTableView = defaultTableViewController.tableView.emptyStateDelegate?.emptyStateShouldScroll() - XCTAssertEqual(true, shouldScrollTableView) + let enableScrollForEmptyState = defaultTableViewController.tableView.emptyStateDelegate?.enableScrollForEmptyState() + XCTAssertEqual(true, enableScrollForEmptyState) } func testShouldScrollDelegatePropertyOnTableCustom() { let customTableViewController = CustomEmptyStateTableViewController() - let shouldScrollTableView = customTableViewController.tableView.emptyStateDelegate?.emptyStateShouldScroll() - XCTAssertEqual(false, shouldScrollTableView) + let enableScrollForEmptyState = customTableViewController.tableView.emptyStateDelegate?.enableScrollForEmptyState() + XCTAssertEqual(false, enableScrollForEmptyState) } // MARK: - UICollectionView func testShouldScrollDelegatePropertyOnCollectionDefault() { let defaultCollectionViewController = DefaultCollectionViewController(collectionViewLayout: UICollectionViewFlowLayout()) - let shouldScrollTableView = defaultCollectionViewController.collectionView.emptyStateDelegate?.emptyStateShouldScroll() - XCTAssertEqual(true, shouldScrollTableView) + let enableScrollForEmptyState = defaultCollectionViewController.collectionView.emptyStateDelegate?.enableScrollForEmptyState() + XCTAssertEqual(true, enableScrollForEmptyState) } func testShouldScrollDelegatePropertyOnCollectionCustom() { let customCollectionViewController = CustomCollectionViewController(collectionViewLayout: UICollectionViewFlowLayout()) - let shouldScrollTableView = customCollectionViewController.collectionView.emptyStateDelegate?.emptyStateShouldScroll() - XCTAssertEqual(false, shouldScrollTableView) + let enableScrollForEmptyState = customCollectionViewController.collectionView.emptyStateDelegate?.enableScrollForEmptyState() + XCTAssertEqual(false, enableScrollForEmptyState) } } diff --git a/WLEmptyState/Classes/Extensions/UICollectionView+WLEmptyState.swift b/WLEmptyState/Classes/Extensions/UICollectionView+WLEmptyState.swift index 18a9f94..cbf903a 100644 --- a/WLEmptyState/Classes/Extensions/UICollectionView+WLEmptyState.swift +++ b/WLEmptyState/Classes/Extensions/UICollectionView+WLEmptyState.swift @@ -61,7 +61,7 @@ extension UICollectionView: WLEmptyStateProtocol { if numberOfItems == 0 && self.subviews.count > 1 { originalScrollingValue = isScrollEnabled - isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? DefaultConstants.shouldScrollOnEmptyState + isScrollEnabled = emptyStateDelegate?.enableScrollForEmptyState() ?? DefaultConstants.enableScrollForEmptyState backgroundView = emptyStateView if let emptyStateView = emptyStateView as? EmptyStateView { diff --git a/WLEmptyState/Classes/Extensions/UITableView+WLEmptyState.swift b/WLEmptyState/Classes/Extensions/UITableView+WLEmptyState.swift index 641eb91..665ddab 100644 --- a/WLEmptyState/Classes/Extensions/UITableView+WLEmptyState.swift +++ b/WLEmptyState/Classes/Extensions/UITableView+WLEmptyState.swift @@ -62,7 +62,7 @@ extension UITableView: WLEmptyStateProtocol { if numberOfItems == 0 && self.subviews.count > 1 { originalScrollingValue = isScrollEnabled - isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? DefaultConstants.shouldScrollOnEmptyState + isScrollEnabled = emptyStateDelegate?.enableScrollForEmptyState() ?? DefaultConstants.enableScrollForEmptyState addSubview(emptyStateView) if let emptyStateView = emptyStateView as? EmptyStateView { diff --git a/WLEmptyState/Classes/Misc/DefaultConstants.swift b/WLEmptyState/Classes/Misc/DefaultConstants.swift index 14751cf..f5ea743 100644 --- a/WLEmptyState/Classes/Misc/DefaultConstants.swift +++ b/WLEmptyState/Classes/Misc/DefaultConstants.swift @@ -9,6 +9,6 @@ import Foundation enum DefaultConstants { - static let shouldScrollOnEmptyState: Bool = true + static let enableScrollForEmptyState: Bool = true } diff --git a/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift b/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift index 26ac5a7..996a462 100644 --- a/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift +++ b/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift @@ -9,13 +9,13 @@ import Foundation public protocol WLEmptyStateDelegate: class { - func emptyStateShouldScroll() -> Bool + func enableScrollForEmptyState() -> Bool } public extension WLEmptyStateDelegate { - func emptyStateShouldScroll() -> Bool { - return DefaultConstants.shouldScrollOnEmptyState + func enableScrollForEmptyState() -> Bool { + return DefaultConstants.enableScrollForEmptyState } }