diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 23dcf79..6862632 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 6E0AEAF7C58394086477F02041E3116C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BD4ED544B638D07C7D755AF1C27116A /* Foundation.framework */; }; 787A205220AB808614F5D13D132EA149 /* WLEmptyState-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DA2CECB345AD9A51DE26C290648DD9B /* WLEmptyState-dummy.m */; }; 796D4CB4F4AB8ECBBD931B099A74E833 /* FBSnapshotTestController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BFB7DE40547F6148458C28227213A42 /* FBSnapshotTestController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7AC01BCC22F38AEB003BBC41 /* DefaultConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC01BCB22F38AEB003BBC41 /* DefaultConstants.swift */; }; 82CE8E0DC98452F08E1A03D3CA91B763 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CAA89EEF1039078430D7A886477E365 /* UIKit.framework */; }; 86BC25FD2CC085B17A374500C747062D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 716A9972B9D9103B54DB950893FAF104 /* QuartzCore.framework */; }; 883DF5A93C5836247391BA4F4084F472 /* WLEmptyStateDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46001DFE9B8BA55912C9A071359DF952 /* WLEmptyStateDelegate.swift */; }; @@ -91,10 +92,10 @@ 23928FDC0ED7C820AD9E342887E20F56 /* WLEmptyStateProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = WLEmptyStateProtocol.swift; sourceTree = ""; }; 23B54D55C8DCD0F868DA457E72A3A336 /* Pods-WLEmptyState_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-WLEmptyState_Tests-frameworks.sh"; sourceTree = ""; }; 265CD8C75ABD553AA7BAE08110CA91EB /* Pods-WLEmptyState_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-WLEmptyState_Tests-dummy.m"; sourceTree = ""; }; - 2B507FEF91037E69863AD9913B0F33E2 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; path = README.md; sourceTree = ""; }; - 2D5FA71EC26145ADE2EF5523A89194E8 /* WLEmptyState.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = WLEmptyState.framework; path = WLEmptyState.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2B507FEF91037E69863AD9913B0F33E2 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 2D5FA71EC26145ADE2EF5523A89194E8 /* WLEmptyState.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WLEmptyState.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2EE0D8468132004B33C282270003A158 /* UIImage+Diff.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+Diff.h"; path = "FBSnapshotTestCase/Categories/UIImage+Diff.h"; sourceTree = ""; }; - 382E0631A928F9F897E7456B47A65AE4 /* WLEmptyState.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; path = WLEmptyState.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 382E0631A928F9F897E7456B47A65AE4 /* WLEmptyState.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; path = WLEmptyState.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 3B465D0AA1B75B79D8358A10B22219A8 /* Logger.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; 3BF0D8E3529AAF9DD2F8B3378FD89216 /* FBSnapshotTestCase.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FBSnapshotTestCase.h; path = FBSnapshotTestCase/FBSnapshotTestCase.h; sourceTree = ""; }; 432D328D5B1788520371534F0EC9AA67 /* SwiftSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftSupport.swift; path = FBSnapshotTestCase/SwiftSupport.swift; sourceTree = ""; }; @@ -110,14 +111,15 @@ 5B1BBF81351D3BE2C4B6DB647665080C /* WLEmptyState-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "WLEmptyState-prefix.pch"; sourceTree = ""; }; 5E601BD54DA9BF4071437E60125281FA /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 5FA455F4C1848537B65373E52124BE30 /* Pods-WLEmptyState_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WLEmptyState_Tests.release.xcconfig"; sourceTree = ""; }; - 601281EDE1A9776D1DF9E51300A5CA12 /* Pods_WLEmptyState_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_WLEmptyState_Tests.framework; path = "Pods-WLEmptyState_Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 601281EDE1A9776D1DF9E51300A5CA12 /* Pods_WLEmptyState_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WLEmptyState_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 61DF90569F26A389D41A44E0EB950F81 /* ResourceBundle-WLEmptyState-WLEmptyState-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-WLEmptyState-WLEmptyState-Info.plist"; sourceTree = ""; }; 64860ED4D1469506201CA2ECB2F54AF9 /* iOSSnapshotTestCase-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "iOSSnapshotTestCase-Info.plist"; sourceTree = ""; }; 651ECCFB431F822BACAFD37B79B23930 /* Pods-WLEmptyState_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WLEmptyState_Tests.debug.xcconfig"; sourceTree = ""; }; - 661E5C00E4D54F4B1EE720D6CB0E051D /* Pods_WLEmptyState_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_WLEmptyState_Example.framework; path = "Pods-WLEmptyState_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + 661E5C00E4D54F4B1EE720D6CB0E051D /* Pods_WLEmptyState_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WLEmptyState_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 6B445E473011D84E70AA46BDEA57247C /* EmptyStateView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = EmptyStateView.swift; sourceTree = ""; }; 716A9972B9D9103B54DB950893FAF104 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; 796F28118D863DD7DDE14D1F6AC3DC9C /* iOSSnapshotTestCase-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "iOSSnapshotTestCase-dummy.m"; sourceTree = ""; }; + 7AC01BCB22F38AEB003BBC41 /* DefaultConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultConstants.swift; sourceTree = ""; }; 7BD4ED544B638D07C7D755AF1C27116A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 7FCBCF80903B45DA453AB5DDE8D7A6C3 /* UICollectionView+WLEmptyState.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "UICollectionView+WLEmptyState.swift"; sourceTree = ""; }; 829DB7B5216ADA72ACE785A166929149 /* WLEmptyStateDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = WLEmptyStateDataSource.swift; sourceTree = ""; }; @@ -126,12 +128,12 @@ 900C95C1DE73EA90A623D23D95C912B0 /* iOSSnapshotTestCase.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = iOSSnapshotTestCase.modulemap; sourceTree = ""; }; 91DD58AC853E63C9E7A077824B07C059 /* Pods-WLEmptyState_Tests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-WLEmptyState_Tests-Info.plist"; sourceTree = ""; }; 9692458AA4CCE1DF8581A004A1E43CC1 /* Pods-WLEmptyState_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-WLEmptyState_Tests-acknowledgements.markdown"; sourceTree = ""; }; - 9B1461BA0DDB214CC99F1297D0A9ABFB /* WLEmptyState.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = WLEmptyState.bundle; path = "WLEmptyState-WLEmptyState.bundle"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9B1461BA0DDB214CC99F1297D0A9ABFB /* WLEmptyState.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WLEmptyState.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; ADF27F24B8BF110336D77D1AAA7CE468 /* Pods-WLEmptyState_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-WLEmptyState_Tests-umbrella.h"; sourceTree = ""; }; B2993DACA98C9F02D8A0CB71FED08A89 /* Pods-WLEmptyState_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-WLEmptyState_Example.modulemap"; sourceTree = ""; }; B75A47899E602A5CA9E833F7D136622D /* iOSSnapshotTestCase.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = iOSSnapshotTestCase.xcconfig; sourceTree = ""; }; - B91B00F8BE943329D633234BD67AE0AC /* FBSnapshotTestCase.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = FBSnapshotTestCase.framework; path = iOSSnapshotTestCase.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B91B00F8BE943329D633234BD67AE0AC /* FBSnapshotTestCase.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FBSnapshotTestCase.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BD3E11CFF525A7BE0F5090E39A8A725C /* FBSnapshotTestCasePlatform.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FBSnapshotTestCasePlatform.m; path = FBSnapshotTestCase/FBSnapshotTestCasePlatform.m; sourceTree = ""; }; C6719E811186D49205511976434B9370 /* Pods-WLEmptyState_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-WLEmptyState_Example-dummy.m"; sourceTree = ""; }; C7AC36E62B80086F28116AF2A338F0CC /* WLEmptyState.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = WLEmptyState.xcconfig; sourceTree = ""; }; @@ -141,7 +143,7 @@ DA6A57F8C023A7771ABC124B0DD3C765 /* Pods-WLEmptyState_Example-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-WLEmptyState_Example-Info.plist"; sourceTree = ""; }; DC37D45B91EAA34C1B307819F4FBFA48 /* FBSnapshotTestCasePlatform.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FBSnapshotTestCasePlatform.h; path = FBSnapshotTestCase/FBSnapshotTestCasePlatform.h; sourceTree = ""; }; E65DA46D3D6E37CAF98E12ACB8E01391 /* Pods-WLEmptyState_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WLEmptyState_Example.release.xcconfig"; sourceTree = ""; }; - E729756D8AB1430F9072D9F98FCC175E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; path = LICENSE; sourceTree = ""; }; + E729756D8AB1430F9072D9F98FCC175E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; EB07CC184E97597B5EF96293FD8D6775 /* UIImage+Compare.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+Compare.m"; path = "FBSnapshotTestCase/Categories/UIImage+Compare.m"; sourceTree = ""; }; EBD54FBC707C522306409616608E03F7 /* UIImage+Snapshot.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+Snapshot.h"; path = "FBSnapshotTestCase/Categories/UIImage+Snapshot.h"; sourceTree = ""; }; ED5A6D3FA1DF67296DBD945B79B922CB /* Pods-WLEmptyState_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WLEmptyState_Example.debug.xcconfig"; sourceTree = ""; }; @@ -281,6 +283,7 @@ 3B465D0AA1B75B79D8358A10B22219A8 /* Logger.swift */, 49D79B4D6AF9A39F6775048CB486FC51 /* Swizzler.swift */, 4A20E8DA676A3BA117B2A2FC28DB81D4 /* WLEmptyState.swift */, + 7AC01BCB22F38AEB003BBC41 /* DefaultConstants.swift */, ); name = Misc; path = WLEmptyState/Classes/Misc; @@ -434,7 +437,6 @@ E8F185C38F4D0FECED758E1073BF7128 /* Support Files */, A222A9C1427FEE47EF8DE5C03195EBC3 /* SwiftSupport */, ); - name = iOSSnapshotTestCase; path = iOSSnapshotTestCase; sourceTree = ""; }; @@ -672,6 +674,7 @@ 2474524F7C71BF56DD6703DBE2B03807 /* UITableView+WLEmptyState.swift in Sources */, 787A205220AB808614F5D13D132EA149 /* WLEmptyState-dummy.m in Sources */, 29092836581744A4869CF30E4C2182C0 /* WLEmptyState.swift in Sources */, + 7AC01BCC22F38AEB003BBC41 /* DefaultConstants.swift in Sources */, 936BFBC785EE65333A5B52AE964CBFF4 /* WLEmptyStateDataSource.swift in Sources */, 883DF5A93C5836247391BA4F4084F472 /* WLEmptyStateDelegate.swift in Sources */, 49B000C28653390705DC788F5C6052F1 /* WLEmptyStateProtocol.swift in Sources */, @@ -1011,8 +1014,7 @@ MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; STRIP_INSTALLED_PRODUCT = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; SYMROOT = "${SRCROOT}/../build"; }; diff --git a/WLEmptyState/Classes/Extensions/UICollectionView+WLEmptyState.swift b/WLEmptyState/Classes/Extensions/UICollectionView+WLEmptyState.swift index c86dcfe..18a9f94 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() ?? true + isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? DefaultConstants.shouldScrollOnEmptyState 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 185f8de..641eb91 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() ?? true + isScrollEnabled = emptyStateDelegate?.emptyStateShouldScroll() ?? DefaultConstants.shouldScrollOnEmptyState addSubview(emptyStateView) if let emptyStateView = emptyStateView as? EmptyStateView { diff --git a/WLEmptyState/Classes/Misc/DefaultConstants.swift b/WLEmptyState/Classes/Misc/DefaultConstants.swift new file mode 100644 index 0000000..14751cf --- /dev/null +++ b/WLEmptyState/Classes/Misc/DefaultConstants.swift @@ -0,0 +1,14 @@ +// +// DefaultConstants.swift +// WLEmptyState +// +// Created by Jorge Ovalle on 8/1/19. +// + +import Foundation + +enum DefaultConstants { + + static let shouldScrollOnEmptyState: Bool = true + +} diff --git a/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift b/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift index 8624745..26ac5a7 100644 --- a/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift +++ b/WLEmptyState/Classes/Protocols/WLEmptyStateDelegate.swift @@ -15,7 +15,7 @@ public protocol WLEmptyStateDelegate: class { public extension WLEmptyStateDelegate { func emptyStateShouldScroll() -> Bool { - return true + return DefaultConstants.shouldScrollOnEmptyState } }