Skip to content

Commit

Permalink
Add type to handle default values
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Ovalle committed Aug 1, 2019
1 parent b0c86dd commit aa2e537
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
26 changes: 14 additions & 12 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extension UICollectionView: WLEmptyStateProtocol {

if numberOfItems == 0 && self.subviews.count > 1 {
originalScrollingValue = isScrollEnabled
isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? true
isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? DefaultConstants.shouldScrollOnEmptyState

backgroundView = emptyStateView
if let emptyStateView = emptyStateView as? EmptyStateView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension UITableView: WLEmptyStateProtocol {

if numberOfItems == 0 && self.subviews.count > 1 {
originalScrollingValue = isScrollEnabled
isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? true
isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? DefaultConstants.shouldScrollOnEmptyState

addSubview(emptyStateView)
if let emptyStateView = emptyStateView as? EmptyStateView {
Expand Down
14 changes: 14 additions & 0 deletions WLEmptyState/Classes/Misc/DefaultConstants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// DefaultConstants.swift
// WLEmptyState
//
// Created by Jorge Ovalle on 8/1/19.
//

import Foundation

enum DefaultConstants {

static let shouldScrollOnEmptyState: Bool = true

}
2 changes: 1 addition & 1 deletion WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public protocol WLEmptyStateDelegate: class {
public extension WLEmptyStateDelegate {

func emptyStateShouldScroll() -> Bool {
return true
return DefaultConstants.shouldScrollOnEmptyState
}

}

0 comments on commit aa2e537

Please sign in to comment.