From 817ad14421a69099e89dad1ca9792488393aef8a Mon Sep 17 00:00:00 2001 From: Pavan Kataria Date: Tue, 18 Jun 2019 17:35:24 +0100 Subject: [PATCH] fix: adds equatable property to DataTableConfiguration and DataTableColumnOrder, configuration tests passing --- .swift-version | 2 +- .../SwiftDataTables.xcodeproj/project.pbxproj | 240 ++++++++++-------- .../SwiftDataTables-Example.xcscheme | 10 + .../Info.plist | 4 +- .../SwiftDataTablesTests.swift | 27 ++ Example/Tests/Tests.swift | 50 ---- SwiftDataTables.podspec | 1 + .../Classes/DataTableConfiguration.swift | 4 +- SwiftDataTables/Classes/SwiftDataTable.swift | 6 +- 9 files changed, 184 insertions(+), 160 deletions(-) rename Example/{Tests => SwiftDataTablesTests}/Info.plist (89%) mode change 100755 => 100644 create mode 100644 Example/SwiftDataTablesTests/SwiftDataTablesTests.swift delete mode 100755 Example/Tests/Tests.swift diff --git a/.swift-version b/.swift-version index 7d5c902..819e07a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.1 +5.0 diff --git a/Example/SwiftDataTables.xcodeproj/project.pbxproj b/Example/SwiftDataTables.xcodeproj/project.pbxproj index 2405f8d..aaaf58e 100644 --- a/Example/SwiftDataTables.xcodeproj/project.pbxproj +++ b/Example/SwiftDataTables.xcodeproj/project.pbxproj @@ -38,14 +38,24 @@ 0583159D2224644B004B4478 /* DataHeaderFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 058315802224644B004B4478 /* DataHeaderFooter.swift */; }; 0583159E2224644B004B4478 /* DataStructureModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 058315812224644B004B4478 /* DataStructureModel.swift */; }; 058D4BB71E954000002A2DC9 /* DataTableWithDataSourceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 058D4BB61E954000002A2DC9 /* DataTableWithDataSourceViewController.swift */; }; + 05D66E6F22B94942003004D9 /* SwiftDataTablesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D66E6E22B94942003004D9 /* SwiftDataTablesTests.swift */; }; 05DDE6B11E71AF2C003BD61E /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05DDE6B01E71AF2C003BD61E /* File.swift */; }; 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 607FACD81AFB9204008FA782 /* DataTableWithDataSetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* DataTableWithDataSetViewController.swift */; }; 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; - 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 05D66E7122B94942003004D9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 607FACC81AFB9204008FA782 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 607FACCF1AFB9204008FA782; + remoteInfo = SwiftDataTables_Example; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 0557FFCA20D18824003EC229 /* MenuTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuTableViewController.swift; sourceTree = ""; }; 0583155E2224644B004B4478 /* SwiftDataTables.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SwiftDataTables.bundle; sourceTree = ""; }; @@ -79,6 +89,9 @@ 058315812224644B004B4478 /* DataStructureModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataStructureModel.swift; sourceTree = ""; }; 058D4BB21E953FDD002A2DC9 /* SwiftDataTables_Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftDataTables_Example-Bridging-Header.h"; sourceTree = ""; }; 058D4BB61E954000002A2DC9 /* DataTableWithDataSourceViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataTableWithDataSourceViewController.swift; sourceTree = ""; }; + 05D66E6C22B94942003004D9 /* SwiftDataTablesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftDataTablesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 05D66E6E22B94942003004D9 /* SwiftDataTablesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDataTablesTests.swift; sourceTree = ""; }; + 05D66E7022B94942003004D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 05DDE6B01E71AF2C003BD61E /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; 607FACD01AFB9204008FA782 /* SwiftDataTables_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftDataTables_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -86,20 +99,17 @@ 607FACD71AFB9204008FA782 /* DataTableWithDataSetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataTableWithDataSetViewController.swift; sourceTree = ""; }; 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 607FACE51AFB9204008FA782 /* SwiftDataTables_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftDataTables_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 607FACCD1AFB9204008FA782 /* Frameworks */ = { + 05D66E6922B94942003004D9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 607FACE21AFB9204008FA782 /* Frameworks */ = { + 607FACCD1AFB9204008FA782 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -202,11 +212,20 @@ path = HeaderFooter; sourceTree = ""; }; + 05D66E6D22B94942003004D9 /* SwiftDataTablesTests */ = { + isa = PBXGroup; + children = ( + 05D66E6E22B94942003004D9 /* SwiftDataTablesTests.swift */, + 05D66E7022B94942003004D9 /* Info.plist */, + ); + path = SwiftDataTablesTests; + sourceTree = ""; + }; 607FACC71AFB9204008FA782 = { isa = PBXGroup; children = ( 607FACD21AFB9204008FA782 /* DemoSwiftDataTables */, - 607FACE81AFB9204008FA782 /* Tests */, + 05D66E6D22B94942003004D9 /* SwiftDataTablesTests */, 607FACD11AFB9204008FA782 /* Products */, ); sourceTree = ""; @@ -215,7 +234,7 @@ isa = PBXGroup; children = ( 607FACD01AFB9204008FA782 /* SwiftDataTables_Example.app */, - 607FACE51AFB9204008FA782 /* SwiftDataTables_Tests.xctest */, + 05D66E6C22B94942003004D9 /* SwiftDataTablesTests.xctest */, ); name = Products; sourceTree = ""; @@ -245,26 +264,27 @@ name = "Supporting Files"; sourceTree = ""; }; - 607FACE81AFB9204008FA782 /* Tests */ = { - isa = PBXGroup; - children = ( - 607FACEB1AFB9204008FA782 /* Tests.swift */, - 607FACE91AFB9204008FA782 /* Supporting Files */, - ); - path = Tests; - sourceTree = ""; - }; - 607FACE91AFB9204008FA782 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 607FACEA1AFB9204008FA782 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 05D66E6B22B94942003004D9 /* SwiftDataTablesTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 05D66E7322B94942003004D9 /* Build configuration list for PBXNativeTarget "SwiftDataTablesTests" */; + buildPhases = ( + 05D66E6822B94942003004D9 /* Sources */, + 05D66E6922B94942003004D9 /* Frameworks */, + 05D66E6A22B94942003004D9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 05D66E7222B94942003004D9 /* PBXTargetDependency */, + ); + name = SwiftDataTablesTests; + productName = SwiftDataTablesTests; + productReference = 05D66E6C22B94942003004D9 /* SwiftDataTablesTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 607FACCF1AFB9204008FA782 /* SwiftDataTables_Example */ = { isa = PBXNativeTarget; buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "SwiftDataTables_Example" */; @@ -282,42 +302,25 @@ productReference = 607FACD01AFB9204008FA782 /* SwiftDataTables_Example.app */; productType = "com.apple.product-type.application"; }; - 607FACE41AFB9204008FA782 /* SwiftDataTables_Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "SwiftDataTables_Tests" */; - buildPhases = ( - 607FACE11AFB9204008FA782 /* Sources */, - 607FACE21AFB9204008FA782 /* Frameworks */, - 607FACE31AFB9204008FA782 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SwiftDataTables_Tests; - productName = Tests; - productReference = 607FACE51AFB9204008FA782 /* SwiftDataTables_Tests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 607FACC81AFB9204008FA782 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0720; + LastSwiftUpdateCheck = 1020; LastUpgradeCheck = 0940; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { - 607FACCF1AFB9204008FA782 = { - CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 1020; + 05D66E6B22B94942003004D9 = { + CreatedOnToolsVersion = 10.2.1; + DevelopmentTeam = R85C7FUGTC; + ProvisioningStyle = Automatic; + TestTargetID = 607FACCF1AFB9204008FA782; }; - 607FACE41AFB9204008FA782 = { + 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = R85C7FUGTC; LastSwiftMigration = 1020; - TestTargetID = 607FACCF1AFB9204008FA782; }; }; }; @@ -335,12 +338,19 @@ projectRoot = ""; targets = ( 607FACCF1AFB9204008FA782 /* SwiftDataTables_Example */, - 607FACE41AFB9204008FA782 /* SwiftDataTables_Tests */, + 05D66E6B22B94942003004D9 /* SwiftDataTablesTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 05D66E6A22B94942003004D9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 607FACCE1AFB9204008FA782 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -355,16 +365,17 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 607FACE31AFB9204008FA782 /* Resources */ = { - isa = PBXResourcesBuildPhase; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 05D66E6822B94942003004D9 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 05D66E6F22B94942003004D9 /* SwiftDataTablesTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ 607FACCC1AFB9204008FA782 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -401,16 +412,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 607FACE11AFB9204008FA782 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 05D66E7222B94942003004D9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 607FACCF1AFB9204008FA782 /* SwiftDataTables_Example */; + targetProxy = 05D66E7122B94942003004D9 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; @@ -423,6 +434,61 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 05D66E7422B94942003004D9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = R85C7FUGTC; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = SwiftDataTablesTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.pavankataria.SwiftDataTablesTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftDataTables_Example.app/SwiftDataTables_Example"; + }; + name = Debug; + }; + 05D66E7522B94942003004D9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = R85C7FUGTC; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = SwiftDataTablesTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.pavankataria.SwiftDataTablesTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftDataTables_Example.app/SwiftDataTables_Example"; + }; + name = Release; + }; 607FACED1AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -577,62 +643,32 @@ }; name = Release; }; - 607FACF31AFB9204008FA782 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - DEVELOPMENT_TEAM = R85C7FUGTC; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 607FACF41AFB9204008FA782 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - DEVELOPMENT_TEAM = R85C7FUGTC; - FRAMEWORK_SEARCH_PATHS = ""; - INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "SwiftDataTables" */ = { + 05D66E7322B94942003004D9 /* Build configuration list for PBXNativeTarget "SwiftDataTablesTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 607FACED1AFB9204008FA782 /* Debug */, - 607FACEE1AFB9204008FA782 /* Release */, + 05D66E7422B94942003004D9 /* Debug */, + 05D66E7522B94942003004D9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "SwiftDataTables_Example" */ = { + 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "SwiftDataTables" */ = { isa = XCConfigurationList; buildConfigurations = ( - 607FACF01AFB9204008FA782 /* Debug */, - 607FACF11AFB9204008FA782 /* Release */, + 607FACED1AFB9204008FA782 /* Debug */, + 607FACEE1AFB9204008FA782 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "SwiftDataTables_Tests" */ = { + 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "SwiftDataTables_Example" */ = { isa = XCConfigurationList; buildConfigurations = ( - 607FACF31AFB9204008FA782 /* Debug */, - 607FACF41AFB9204008FA782 /* Release */, + 607FACF01AFB9204008FA782 /* Debug */, + 607FACF11AFB9204008FA782 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/Example/SwiftDataTables.xcodeproj/xcshareddata/xcschemes/SwiftDataTables-Example.xcscheme b/Example/SwiftDataTables.xcodeproj/xcshareddata/xcschemes/SwiftDataTables-Example.xcscheme index f3e1ea7..310a23b 100755 --- a/Example/SwiftDataTables.xcodeproj/xcshareddata/xcschemes/SwiftDataTables-Example.xcscheme +++ b/Example/SwiftDataTables.xcodeproj/xcshareddata/xcschemes/SwiftDataTables-Example.xcscheme @@ -52,6 +52,16 @@ ReferencedContainer = "container:SwiftDataTables.xcodeproj"> + + + + CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -16,8 +16,6 @@ BNDL CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion 1 diff --git a/Example/SwiftDataTablesTests/SwiftDataTablesTests.swift b/Example/SwiftDataTablesTests/SwiftDataTablesTests.swift new file mode 100644 index 0000000..ed5c8e7 --- /dev/null +++ b/Example/SwiftDataTablesTests/SwiftDataTablesTests.swift @@ -0,0 +1,27 @@ +// +// SwiftDataTablesTests.swift +// SwiftDataTablesTests +// +// Created by Pavan Kataria on 18/06/2019. +// Copyright © 2019 CocoaPods. All rights reserved. +// + +import XCTest +@testable import SwiftDataTables_Example + +class SwiftDataTablesTests: XCTestCase { + + func test_swiftDataTable_withConfigurationOptions_initialises() { + var configuration : DataTableConfiguration = DataTableConfiguration() + configuration.highlightedAlternatingRowColors = [ + .init(1, 0.7, 0.7), .init(1, 0.7, 0.5), .init(1, 1, 0.5), .init(0.5, 1, 0.5), .init(0.5, 0.7, 1), .init(0.5, 0.5, 1), .init(1, 0.5, 0.5) + ] + configuration.unhighlightedAlternatingRowColors = [ + .init(1, 0.90, 0.90), .init(1, 0.90, 0.7), .init(1, 1, 0.7), .init(0.7, 1, 0.7), .init(0.7, 0.9, 1), .init(0.7, 0.7, 1), .init(1, 0.7, 0.7) + ] + + let dataTable = SwiftDataTable(data: [[String]](), headerTitles: [], options: configuration, frame: .zero) + + XCTAssertEqual(dataTable.options, configuration) + } +} diff --git a/Example/Tests/Tests.swift b/Example/Tests/Tests.swift deleted file mode 100755 index fc02d54..0000000 --- a/Example/Tests/Tests.swift +++ /dev/null @@ -1,50 +0,0 @@ -// https://github.com/Quick/Quick - -//import Quick -//import Nimble -//import SwiftDataTables -// -//class TableOfContentsSpec: QuickSpec { -// override func spec() { -// describe("these will fail") { -// -// it("can do maths") { -// expect(1) == 2 -// } -// -// it("can read") { -// expect("number") == "string" -// } -// -// it("will eventually fail") { -// expect("time").toEventually( equal("done") ) -// } -// -// context("these will pass") { -// -// it("can do maths") { -// expect(23) == 23 -// } -// -// it("can read") { -// expect("🐮") == "🐮" -// } -// -// it("will eventually pass") { -// var time = "passing" -// -// DispatchQueue.main.async { -// time = "done" -// } -// -// waitUntil { done in -// Thread.sleep(forTimeInterval: 0.5) -// expect(time) == "done" -// -// done() -// } -// } -// } -// } -// } -//} diff --git a/SwiftDataTables.podspec b/SwiftDataTables.podspec index b54baef..69cc9e6 100755 --- a/SwiftDataTables.podspec +++ b/SwiftDataTables.podspec @@ -10,6 +10,7 @@ Pod::Spec.new do |s| s.name = 'SwiftDataTables' s.version = '0.7.4' s.summary = 'A Swift Data Table package that allows ordering, searching, and paging with extensible options.' + s.swift_version = '5.0' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? diff --git a/SwiftDataTables/Classes/DataTableConfiguration.swift b/SwiftDataTables/Classes/DataTableConfiguration.swift index 7dba1da..27f4449 100755 --- a/SwiftDataTables/Classes/DataTableConfiguration.swift +++ b/SwiftDataTables/Classes/DataTableConfiguration.swift @@ -9,7 +9,7 @@ import Foundation import UIKit -public struct DataTableColumnOrder { +public struct DataTableColumnOrder: Equatable { //MARK: - Properties let index: Int let order: DataTableSortType @@ -18,7 +18,7 @@ public struct DataTableColumnOrder { self.order = order } } -public struct DataTableConfiguration { +public struct DataTableConfiguration: Equatable { public var defaultOrdering: DataTableColumnOrder? = nil public var heightForSectionFooter: CGFloat = 44 public var heightForSectionHeader: CGFloat = 44 diff --git a/SwiftDataTables/Classes/SwiftDataTable.swift b/SwiftDataTables/Classes/SwiftDataTable.swift index 8a7ed9d..7d0f6e1 100755 --- a/SwiftDataTables/Classes/SwiftDataTable.swift +++ b/SwiftDataTables/Classes/SwiftDataTable.swift @@ -154,10 +154,10 @@ public class SwiftDataTable: UIView { public init(data: DataTableContent, headerTitles: [String], - options: DataTableConfiguration? = DataTableConfiguration(), + options: DataTableConfiguration = DataTableConfiguration(), frame: CGRect = .zero) { - self.options = options! + self.options = options super.init(frame: frame) self.set(data: data, headerTitles: headerTitles, options: options, shouldReplaceLayout: true) self.registerObservers() @@ -172,6 +172,7 @@ public class SwiftDataTable: UIView { self.init( data: data.map { $0.map { .string($0) }}, headerTitles: headerTitles, + options: options, frame: frame ) } @@ -180,6 +181,7 @@ public class SwiftDataTable: UIView { fatalError("init(coder:) has not been implemented") } + deinit { NotificationCenter.default.removeObserver(self, name: UIApplication.willChangeStatusBarOrientationNotification, object: nil) }