From bf5e4ef92f4d0def2d49a4f665c87d48bb05cc98 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Mon, 25 Jan 2021 13:54:31 +0330 Subject: [PATCH 01/20] Migrated to Swift 5 and removed all the errors when setting minimum deployment target to 11. --- .../project.pbxproj | 74 ++++++++++++---- ...apsibleTableSectionViewController.xcscheme | 28 +++---- ...ollapsibleTableSectionViewController.swift | 4 +- Examples/Examples.xcodeproj/project.pbxproj | 29 ++++--- .../AppIcon.appiconset/Contents.json | 84 +++++++++++++------ 5 files changed, 145 insertions(+), 74 deletions(-) diff --git a/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj b/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj index 49f5fdc..075ea8f 100644 --- a/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj +++ b/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj @@ -22,6 +22,13 @@ remoteGlobalIDString = 0A8BD66B1F231B2C003D6155; remoteInfo = CollapsibleTableSectionViewController; }; + 45748ECC25BEB80C00674BB2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 45748EC825BEB80C00674BB2 /* Examples.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 0AC886DB1F226627007E4E2F; + remoteInfo = Examples; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -33,6 +40,7 @@ 0A8BD67C1F231B2C003D6155 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 0A8BD6861F231DF2003D6155 /* CollapsibleTableSectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollapsibleTableSectionViewController.swift; sourceTree = ""; }; 0A8BD6881F231DF2003D6155 /* CollapsibleTableViewHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollapsibleTableViewHeader.swift; sourceTree = ""; }; + 45748EC825BEB80C00674BB2 /* Examples.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Examples.xcodeproj; path = Examples/Examples.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -60,6 +68,7 @@ 0A8BD66E1F231B2C003D6155 /* CollapsibleTableSectionViewController */, 0A8BD6791F231B2C003D6155 /* CollapsibleTableSectionViewControllerTests */, 0A8BD66D1F231B2C003D6155 /* Products */, + 45748EC825BEB80C00674BB2 /* Examples.xcodeproj */, ); sourceTree = ""; }; @@ -75,9 +84,9 @@ 0A8BD66E1F231B2C003D6155 /* CollapsibleTableSectionViewController */ = { isa = PBXGroup; children = ( + 0A8BD66F1F231B2C003D6155 /* CollapsibleTableSectionViewController.h */, 0A8BD6861F231DF2003D6155 /* CollapsibleTableSectionViewController.swift */, 0A8BD6881F231DF2003D6155 /* CollapsibleTableViewHeader.swift */, - 0A8BD66F1F231B2C003D6155 /* CollapsibleTableSectionViewController.h */, 0A8BD6701F231B2C003D6155 /* Info.plist */, ); path = CollapsibleTableSectionViewController; @@ -92,6 +101,14 @@ path = CollapsibleTableSectionViewControllerTests; sourceTree = ""; }; + 45748EC925BEB80C00674BB2 /* Products */ = { + isa = PBXGroup; + children = ( + 45748ECD25BEB80C00674BB2 /* Examples.app */, + ); + name = Products; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -149,24 +166,25 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1230; ORGANIZATIONNAME = jeantimex; TargetAttributes = { 0A8BD66B1F231B2C003D6155 = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 1010; + LastSwiftMigration = 1230; ProvisioningStyle = Automatic; }; 0A8BD6741F231B2C003D6155 = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 1010; + DevelopmentTeam = 589RNFRDJ2; + LastSwiftMigration = 1230; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 0A8BD6661F231B2C003D6155 /* Build configuration list for PBXProject "CollapsibleTableSectionViewController" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -174,6 +192,12 @@ mainGroup = 0A8BD6621F231B2C003D6155; productRefGroup = 0A8BD66D1F231B2C003D6155 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 45748EC925BEB80C00674BB2 /* Products */; + ProjectRef = 45748EC825BEB80C00674BB2 /* Examples.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 0A8BD66B1F231B2C003D6155 /* CollapsibleTableSectionViewController */, @@ -182,6 +206,16 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 45748ECD25BEB80C00674BB2 /* Examples.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = Examples.app; + remoteRef = 45748ECC25BEB80C00674BB2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 0A8BD66A1F231B2C003D6155 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -232,6 +266,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -253,6 +288,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -278,7 +314,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -294,6 +330,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; @@ -315,6 +352,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -334,7 +372,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -356,14 +394,14 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = CollapsibleTableSectionViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jeantimex.com.CollapsibleTableSectionViewController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.2; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -378,13 +416,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = CollapsibleTableSectionViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jeantimex.com.CollapsibleTableSectionViewController; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.2; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -392,12 +430,13 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + DEVELOPMENT_TEAM = 589RNFRDJ2; INFOPLIST_FILE = CollapsibleTableSectionViewControllerTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jeantimex.com.CollapsibleTableSectionViewControllerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.2; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -405,12 +444,13 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + DEVELOPMENT_TEAM = 589RNFRDJ2; INFOPLIST_FILE = CollapsibleTableSectionViewControllerTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jeantimex.com.CollapsibleTableSectionViewControllerTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.2; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/CollapsibleTableSectionViewController.xcodeproj/xcshareddata/xcschemes/CollapsibleTableSectionViewController.xcscheme b/CollapsibleTableSectionViewController.xcodeproj/xcshareddata/xcschemes/CollapsibleTableSectionViewController.xcscheme index bf5a772..af1db53 100644 --- a/CollapsibleTableSectionViewController.xcodeproj/xcshareddata/xcschemes/CollapsibleTableSectionViewController.xcscheme +++ b/CollapsibleTableSectionViewController.xcodeproj/xcshareddata/xcschemes/CollapsibleTableSectionViewController.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -40,17 +49,6 @@ - - - - - - - - Date: Tue, 26 Jan 2021 09:46:16 +0330 Subject: [PATCH 02/20] Changed the arrow "label" to a UIImage view to increase customizability options. --- .../project.pbxproj | 19 +++++++++++++++-- .../Assets.xcassets/Contents.json | 6 ++++++ .../arrow.imageset/Contents.json | 21 +++++++++++++++++++ .../iconfinder_arrow_right2_1814086.svg | 9 ++++++++ ...ollapsibleTableSectionViewController.swift | 6 ++++-- .../CollapsibleTableViewHeader.swift | 18 ++++++++-------- 6 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 CollapsibleTableSectionViewController/Assets.xcassets/Contents.json create mode 100644 CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/Contents.json create mode 100644 CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/iconfinder_arrow_right2_1814086.svg diff --git a/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj b/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj index 075ea8f..f438b95 100644 --- a/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj +++ b/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 0A8BD67D1F231B2C003D6155 /* CollapsibleTableSectionViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A8BD66F1F231B2C003D6155 /* CollapsibleTableSectionViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 0A8BD68A1F231DF2003D6155 /* CollapsibleTableSectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8BD6861F231DF2003D6155 /* CollapsibleTableSectionViewController.swift */; }; 0A8BD68C1F231DF2003D6155 /* CollapsibleTableViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8BD6881F231DF2003D6155 /* CollapsibleTableViewHeader.swift */; }; + 45748F0225BEE9D100674BB2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 45748F0125BEE9D100674BB2 /* Assets.xcassets */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -41,6 +42,7 @@ 0A8BD6861F231DF2003D6155 /* CollapsibleTableSectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollapsibleTableSectionViewController.swift; sourceTree = ""; }; 0A8BD6881F231DF2003D6155 /* CollapsibleTableViewHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollapsibleTableViewHeader.swift; sourceTree = ""; }; 45748EC825BEB80C00674BB2 /* Examples.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Examples.xcodeproj; path = Examples/Examples.xcodeproj; sourceTree = ""; }; + 45748F0125BEE9D100674BB2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -87,6 +89,7 @@ 0A8BD66F1F231B2C003D6155 /* CollapsibleTableSectionViewController.h */, 0A8BD6861F231DF2003D6155 /* CollapsibleTableSectionViewController.swift */, 0A8BD6881F231DF2003D6155 /* CollapsibleTableViewHeader.swift */, + 45748F0125BEE9D100674BB2 /* Assets.xcassets */, 0A8BD6701F231B2C003D6155 /* Info.plist */, ); path = CollapsibleTableSectionViewController; @@ -165,6 +168,9 @@ 0A8BD6631F231B2C003D6155 /* Project object */ = { isa = PBXProject; attributes = { + KnownAssetTags = ( + 1, + ); LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 1230; ORGANIZATIONNAME = jeantimex; @@ -221,6 +227,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 45748F0225BEE9D100674BB2 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -298,6 +305,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; + EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -314,9 +322,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; + RESOURCES_TARGETED_DEVICE_FAMILY = ""; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -362,6 +371,7 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -372,8 +382,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; + RESOURCES_TARGETED_DEVICE_FAMILY = ""; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; @@ -389,9 +400,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; + DEVELOPMENT_ASSET_PATHS = CollapsibleTableSectionViewController/Assets.xcassets; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_ON_DEMAND_RESOURCES = NO; INFOPLIST_FILE = CollapsibleTableSectionViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; @@ -411,9 +424,11 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; + DEVELOPMENT_ASSET_PATHS = CollapsibleTableSectionViewController/Assets.xcassets; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_ON_DEMAND_RESOURCES = NO; INFOPLIST_FILE = CollapsibleTableSectionViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; diff --git a/CollapsibleTableSectionViewController/Assets.xcassets/Contents.json b/CollapsibleTableSectionViewController/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CollapsibleTableSectionViewController/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/Contents.json b/CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/Contents.json new file mode 100644 index 0000000..032faed --- /dev/null +++ b/CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "iconfinder_arrow_right2_1814086.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/iconfinder_arrow_right2_1814086.svg b/CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/iconfinder_arrow_right2_1814086.svg new file mode 100644 index 0000000..712494d --- /dev/null +++ b/CollapsibleTableSectionViewController/Assets.xcassets/arrow.imageset/iconfinder_arrow_right2_1814086.svg @@ -0,0 +1,9 @@ + + + iconfinder_arrow_right2_1814086 + + + + + + \ No newline at end of file diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 1f5b878..7bc38be 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -32,6 +32,8 @@ open class CollapsibleTableSectionViewController: UIViewController { fileprivate var _tableView: UITableView! fileprivate var _sectionsState = [Int : Bool]() + open var arrowIcon = UIImage(named: "arrow", in: Bundle.init(identifier: "jeantimex.com.CollapsibleTableSectionViewController"), compatibleWith: nil) + open var arrowColor: UIColor! = .white public func isSectionCollapsed(_ section: Int) -> Bool { if _sectionsState.index(forKey: section) == nil { @@ -123,9 +125,9 @@ extension CollapsibleTableSectionViewController: UITableViewDataSource, UITableV let title = delegate?.collapsibleTableView?(tableView, titleForHeaderInSection: section) ?? "" header.titleLabel.text = title - header.arrowLabel.text = ">" + header.arrowImageView.image = self.arrowIcon!.withRenderingMode(.alwaysTemplate) header.setCollapsed(isSectionCollapsed(section)) - + header.arrowImageView.tintColor = self.arrowColor header.section = section header.delegate = self diff --git a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift index c464a0e..745d3e9 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift @@ -18,7 +18,7 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { var section: Int = 0 let titleLabel = UILabel() - let arrowLabel = UILabel() + let arrowImageView = UIImageView() override public init(reuseIdentifier: String?) { super.init(reuseIdentifier: reuseIdentifier) @@ -29,13 +29,13 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { let marginGuide = contentView.layoutMarginsGuide // Arrow label - contentView.addSubview(arrowLabel) - arrowLabel.textColor = UIColor.white - arrowLabel.translatesAutoresizingMaskIntoConstraints = false - arrowLabel.widthAnchor.constraint(equalToConstant: 12).isActive = true - arrowLabel.topAnchor.constraint(equalTo: marginGuide.topAnchor).isActive = true - arrowLabel.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor).isActive = true - arrowLabel.bottomAnchor.constraint(equalTo: marginGuide.bottomAnchor).isActive = true + contentView.addSubview(arrowImageView) + arrowImageView.contentMode = .scaleAspectFit + arrowImageView.translatesAutoresizingMaskIntoConstraints = false + arrowImageView.widthAnchor.constraint(equalToConstant: 8).isActive = true + arrowImageView.topAnchor.constraint(equalTo: marginGuide.topAnchor).isActive = true + arrowImageView.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor).isActive = true + arrowImageView.bottomAnchor.constraint(equalTo: marginGuide.bottomAnchor).isActive = true // Title label contentView.addSubview(titleLabel) @@ -71,7 +71,7 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { // // Animate the arrow rotation (see Extensions.swf) // - arrowLabel.rotate(collapsed ? 0.0 : .pi / 2) + arrowImageView.rotate(collapsed ? 0.0 : .pi / 2) } } From 9bcad97923877d38ed5ab82004bd63121eb0f694 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 10:16:48 +0330 Subject: [PATCH 03/20] Changed the animation into a CGAffine transform animation and fixed the bug that set the incorrect arrow rotation when tableview reloads. --- .../CollapsibleTableViewHeader.swift | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift index 745d3e9..abb4c7f 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift @@ -65,6 +65,9 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { } _ = delegate?.toggleSection(cell.section) + UIView.animate(withDuration: 0.2) { + self.arrowImageView.transform = .init(rotationAngle: .pi / 2) + } } func setCollapsed(_ collapsed: Bool) { @@ -92,16 +95,11 @@ extension UIColor { extension UIView { func rotate(_ toValue: CGFloat, duration: CFTimeInterval = 0.2) { - let animation = CABasicAnimation(keyPath: "transform.rotation") - - animation.toValue = toValue - animation.duration = duration - animation.isRemovedOnCompletion = false - animation.fillMode = CAMediaTimingFillMode.forwards - - self.layer.add(animation, forKey: nil) + UIView.animate(withDuration: duration) { + self.transform = .init(rotationAngle: toValue) + + } } - } From 96fee0ec3ea077a2e3ae1773fb034ac9afc3582b Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 11:10:31 +0330 Subject: [PATCH 04/20] Added the missing animation for the arrow going back when collapsing. --- .../CollapsibleTableViewHeader.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift index abb4c7f..ae6d832 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift @@ -16,6 +16,7 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { var delegate: CollapsibleTableViewHeaderDelegate? var section: Int = 0 + var isCollapsed: Bool = false let titleLabel = UILabel() let arrowImageView = UIImageView() @@ -66,7 +67,11 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { _ = delegate?.toggleSection(cell.section) UIView.animate(withDuration: 0.2) { - self.arrowImageView.transform = .init(rotationAngle: .pi / 2) + if self.isCollapsed == false { + self.arrowImageView.transform = .identity + } else { + self.arrowImageView.transform = .init(rotationAngle: .pi / 2) + } } } @@ -74,6 +79,7 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { // // Animate the arrow rotation (see Extensions.swf) // + self.isCollapsed = collapsed arrowImageView.rotate(collapsed ? 0.0 : .pi / 2) } @@ -95,10 +101,7 @@ extension UIColor { extension UIView { func rotate(_ toValue: CGFloat, duration: CFTimeInterval = 0.2) { - UIView.animate(withDuration: duration) { - self.transform = .init(rotationAngle: toValue) - - } + self.transform = .init(rotationAngle: toValue) } } From 22df8aadd64ba2b38a8fe36ce61c8ba12ccb1686 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 11:17:21 +0330 Subject: [PATCH 05/20] Added section background color customization. --- .../CollapsibleTableSectionViewController.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 7bc38be..934c549 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -34,6 +34,7 @@ open class CollapsibleTableSectionViewController: UIViewController { fileprivate var _sectionsState = [Int : Bool]() open var arrowIcon = UIImage(named: "arrow", in: Bundle.init(identifier: "jeantimex.com.CollapsibleTableSectionViewController"), compatibleWith: nil) open var arrowColor: UIColor! = .white + open var sectionBackgroundColor = UIColor(hex: 0x2E3944) public func isSectionCollapsed(_ section: Int) -> Bool { if _sectionsState.index(forKey: section) == nil { @@ -128,6 +129,7 @@ extension CollapsibleTableSectionViewController: UITableViewDataSource, UITableV header.arrowImageView.image = self.arrowIcon!.withRenderingMode(.alwaysTemplate) header.setCollapsed(isSectionCollapsed(section)) header.arrowImageView.tintColor = self.arrowColor + header.contentView.backgroundColor = self.sectionBackgroundColor header.section = section header.delegate = self From f49bea65427fd51d90695a8a5802e129c1e2db86 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 11:48:45 +0330 Subject: [PATCH 06/20] Added section alignment option to change the alignment of the entire section. --- ...ollapsibleTableSectionViewController.swift | 3 +++ .../CollapsibleTableViewHeader.swift | 26 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 934c549..0409851 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -32,9 +32,11 @@ open class CollapsibleTableSectionViewController: UIViewController { fileprivate var _tableView: UITableView! fileprivate var _sectionsState = [Int : Bool]() + open var arrowIcon = UIImage(named: "arrow", in: Bundle.init(identifier: "jeantimex.com.CollapsibleTableSectionViewController"), compatibleWith: nil) open var arrowColor: UIColor! = .white open var sectionBackgroundColor = UIColor(hex: 0x2E3944) + open var sectionAlignment: NSTextAlignment = .left public func isSectionCollapsed(_ section: Int) -> Bool { if _sectionsState.index(forKey: section) == nil { @@ -128,6 +130,7 @@ extension CollapsibleTableSectionViewController: UITableViewDataSource, UITableV header.titleLabel.text = title header.arrowImageView.image = self.arrowIcon!.withRenderingMode(.alwaysTemplate) header.setCollapsed(isSectionCollapsed(section)) + header.alignment = self.sectionAlignment header.arrowImageView.tintColor = self.arrowColor header.contentView.backgroundColor = self.sectionBackgroundColor header.section = section diff --git a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift index ae6d832..4071414 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift @@ -14,9 +14,17 @@ protocol CollapsibleTableViewHeaderDelegate { open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { + fileprivate var isCollapsed: Bool = false + fileprivate var arrowXConstraint: NSLayoutConstraint! + + var alignment: NSTextAlignment = .left { + didSet { + self.changeAlignment(alignment: self.alignment) + } + } + var delegate: CollapsibleTableViewHeaderDelegate? var section: Int = 0 - var isCollapsed: Bool = false let titleLabel = UILabel() let arrowImageView = UIImageView() @@ -35,12 +43,14 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { arrowImageView.translatesAutoresizingMaskIntoConstraints = false arrowImageView.widthAnchor.constraint(equalToConstant: 8).isActive = true arrowImageView.topAnchor.constraint(equalTo: marginGuide.topAnchor).isActive = true - arrowImageView.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor).isActive = true + self.arrowXConstraint = arrowImageView.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor) + self.arrowXConstraint.isActive = true arrowImageView.bottomAnchor.constraint(equalTo: marginGuide.bottomAnchor).isActive = true // Title label contentView.addSubview(titleLabel) titleLabel.textColor = UIColor.white + titleLabel.textAlignment = .left titleLabel.translatesAutoresizingMaskIntoConstraints = false titleLabel.topAnchor.constraint(equalTo: marginGuide.topAnchor).isActive = true titleLabel.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor).isActive = true @@ -57,6 +67,18 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { fatalError("init(coder:) has not been implemented") } + fileprivate func changeAlignment(alignment: NSTextAlignment) { + let marginGuide = contentView.layoutMarginsGuide + self.arrowXConstraint.isActive = false + if alignment == .right { + self.arrowXConstraint = arrowImageView.leadingAnchor.constraint(equalTo: marginGuide.leadingAnchor) + } else { + self.arrowXConstraint = arrowImageView.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor) + } + self.arrowXConstraint.isActive = true + self.titleLabel.textAlignment = alignment + } + // // Trigger toggle section when tapping on the header // From 187a003c573870c87c3014b466d236280e6c164f Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 11:51:11 +0330 Subject: [PATCH 07/20] Added documentation for the added options. --- .../CollapsibleTableSectionViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 0409851..616271a 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -33,9 +33,13 @@ open class CollapsibleTableSectionViewController: UIViewController { fileprivate var _tableView: UITableView! fileprivate var _sectionsState = [Int : Bool]() + /// Sets the image for the arrow icon. open var arrowIcon = UIImage(named: "arrow", in: Bundle.init(identifier: "jeantimex.com.CollapsibleTableSectionViewController"), compatibleWith: nil) + /// Sets the color for the arrow icon. open var arrowColor: UIColor! = .white + /// Sets the background of the sections. open var sectionBackgroundColor = UIColor(hex: 0x2E3944) + /// Sets the alignment for the entire sections. open var sectionAlignment: NSTextAlignment = .left public func isSectionCollapsed(_ section: Int) -> Bool { From 6501554b552b453d4824c507185ae8deaf1abb75 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 11:57:46 +0330 Subject: [PATCH 08/20] Added minimum development version support for iOS 9 and higher. --- .../project.pbxproj | 8 ++++---- .../CollapsibleTableSectionViewController.swift | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj b/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj index f438b95..168f312 100644 --- a/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj +++ b/CollapsibleTableSectionViewController.xcodeproj/project.pbxproj @@ -322,7 +322,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; RESOURCES_TARGETED_DEVICE_FAMILY = ""; @@ -382,7 +382,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; RESOURCES_TARGETED_DEVICE_FAMILY = ""; SDKROOT = iphoneos; @@ -407,7 +407,7 @@ ENABLE_ON_DEMAND_RESOURCES = NO; INFOPLIST_FILE = CollapsibleTableSectionViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jeantimex.com.CollapsibleTableSectionViewController; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -431,7 +431,7 @@ ENABLE_ON_DEMAND_RESOURCES = NO; INFOPLIST_FILE = CollapsibleTableSectionViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jeantimex.com.CollapsibleTableSectionViewController; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 616271a..984d62f 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -90,8 +90,13 @@ open class CollapsibleTableSectionViewController: UIViewController { // Auto layout the tableView view.addSubview(_tableView) _tableView.translatesAutoresizingMaskIntoConstraints = false - _tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true - _tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true + if #available(iOS 11.0, *) { + _tableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true + _tableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true + } else { + _tableView.topAnchor.constraint(equalTo: topLayoutGuide.topAnchor).isActive = true + _tableView.bottomAnchor.constraint(equalTo: bottomLayoutGuide.bottomAnchor).isActive = true + } _tableView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true _tableView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true } From 34fff98a25f46ee558f24968842be973e101a6b5 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 12:05:22 +0330 Subject: [PATCH 09/20] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 675cda6..e7ce7ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: objective-c -osx_image: xcode10.1 +osx_image: xcode12 script: - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,name=iPhone 7' after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file + - bash <(curl -s https://codecov.io/bash) From ffc3893f8da2abba1a9232d5875cbe98754b69ad Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 12:26:39 +0330 Subject: [PATCH 10/20] Update XCTests --- .travis.yml | 5 +++++ .../CollapsibleTableViewHeader.swift | 1 + .../CollapsibleTableSectionViewControllerTests.swift | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e7ce7ae..dd59380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ language: objective-c osx_image: xcode12 +env: + global: + - LC_CTYPE=en_US.UTF-8 + - LANG=en_US.UTF-8 + - IOS_SDK=iphonesimulator14.0 script: - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,name=iPhone 7' after_success: diff --git a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift index 4071414..c2e1c6d 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableViewHeader.swift @@ -39,6 +39,7 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView { // Arrow label contentView.addSubview(arrowImageView) + arrowImageView.tintColor = .white arrowImageView.contentMode = .scaleAspectFit arrowImageView.translatesAutoresizingMaskIntoConstraints = false arrowImageView.widthAnchor.constraint(equalToConstant: 8).isActive = true diff --git a/CollapsibleTableSectionViewControllerTests/CollapsibleTableSectionViewControllerTests.swift b/CollapsibleTableSectionViewControllerTests/CollapsibleTableSectionViewControllerTests.swift index 3b8b267..3b60feb 100644 --- a/CollapsibleTableSectionViewControllerTests/CollapsibleTableSectionViewControllerTests.swift +++ b/CollapsibleTableSectionViewControllerTests/CollapsibleTableSectionViewControllerTests.swift @@ -343,7 +343,7 @@ class CollapsibleTableSectionViewControllerTests: XCTestCase { func testCollapsibleTableViewHeader() { let header = CollapsibleTableViewHeader.init(reuseIdentifier: "Cell") - XCTAssertEqual(header.arrowLabel.textColor, UIColor.white) + XCTAssertEqual(header.arrowImageView.tintColor, UIColor.white) XCTAssertEqual(header.titleLabel.textColor, UIColor.white) } From 9d605eaed8404fea96488abc41dd3629c97d18cd Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 12:41:27 +0330 Subject: [PATCH 11/20] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd59380..eb3ed5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: - LANG=en_US.UTF-8 - IOS_SDK=iphonesimulator14.0 script: - - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,name=iPhone 7' + - xcodebuild -showsdks + - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme 'CollapsibleTableSectionViewController' -sdk $IOS_SDK build analyze after_success: - bash <(curl -s https://codecov.io/bash) From 30887a4925b22a017811447865a6d263b2d5ff89 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 12:46:15 +0330 Subject: [PATCH 12/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb3ed5f..7d5e8df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,6 @@ env: - IOS_SDK=iphonesimulator14.0 script: - xcodebuild -showsdks - - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme 'CollapsibleTableSectionViewController' -sdk $IOS_SDK build analyze + - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme 'CollapsibleTableSectionViewController' -destination 'platforms=iOS Simulatior,name=iPhone 12' after_success: - bash <(curl -s https://codecov.io/bash) From 88ade2dec649460ab1cfc016259936d0c60b4798 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 12:57:37 +0330 Subject: [PATCH 13/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7d5e8df..83f9ef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,6 @@ env: - IOS_SDK=iphonesimulator14.0 script: - xcodebuild -showsdks - - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme 'CollapsibleTableSectionViewController' -destination 'platforms=iOS Simulatior,name=iPhone 12' + - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme 'CollapsibleTableSectionViewController' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11, OS=14' build test after_success: - bash <(curl -s https://codecov.io/bash) From 41aa214904433b1230f869d4f6b461c2b5f84182 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 13:43:30 +0330 Subject: [PATCH 14/20] update .travis.yml --- .travis.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83f9ef7..39c3a98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,6 @@ language: objective-c osx_image: xcode12 -env: - global: - - LC_CTYPE=en_US.UTF-8 - - LANG=en_US.UTF-8 - - IOS_SDK=iphonesimulator14.0 script: - - xcodebuild -showsdks - - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme 'CollapsibleTableSectionViewController' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11, OS=14' build test -after_success: + - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,OS=14,name=iPhone 11' + after_success: - bash <(curl -s https://codecov.io/bash) From e71eebb6043efec2625379ee641f8b6b2367c5cd Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 13:57:32 +0330 Subject: [PATCH 15/20] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 39c3a98..520684c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: objective-c osx_image: xcode12 script: - - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,OS=14,name=iPhone 11' - after_success: + - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,OS=14,name=iPhone 11' +after_success: - bash <(curl -s https://codecov.io/bash) From 8ee4ba882e4ca3db0709aa718d34d3c87fb30e16 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Tue, 26 Jan 2021 14:22:37 +0330 Subject: [PATCH 16/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 520684c..6062519 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: objective-c osx_image: xcode12 script: - - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,OS=14,name=iPhone 11' + - xcodebuild test -project CollapsibleTableSectionViewController.xcodeproj -scheme CollapsibleTableSectionViewController -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1' build test after_success: - bash <(curl -s https://codecov.io/bash) From 25f3b6470d7bd7f65be64740f68f2f5dc175a893 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Sun, 31 Jan 2021 09:34:20 +0330 Subject: [PATCH 17/20] Added the ability to change the background color of the table view. --- .../CollapsibleTableSectionViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 984d62f..4dd5e61 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -41,6 +41,12 @@ open class CollapsibleTableSectionViewController: UIViewController { open var sectionBackgroundColor = UIColor(hex: 0x2E3944) /// Sets the alignment for the entire sections. open var sectionAlignment: NSTextAlignment = .left + /// Sets the background color for the table view. + open var backgroundColor: UIColor = .clear { + didSet { + self._tableView.backgroundColor = self.backgroundColor + } + } public func isSectionCollapsed(_ section: Int) -> Bool { if _sectionsState.index(forKey: section) == nil { From 4138da2c882a9453c59b88c25184769007361c27 Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Sun, 31 Jan 2021 10:50:23 +0330 Subject: [PATCH 18/20] Added row height and separator style to customize. --- .../CollapsibleTableSectionViewController.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 4dd5e61..bff4fc8 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -47,6 +47,18 @@ open class CollapsibleTableSectionViewController: UIViewController { self._tableView.backgroundColor = self.backgroundColor } } + /// Sets the height of each row. + open var rowHeight: CGFloat? { + didSet { + self._tableView.rowHeight = self.rowHeight! + } + } + /// Sets the separation style of the tableview. + open var separatorStyle: UITableViewCell.SeparatorStyle? { + didSet { + self._tableView.separatorStyle = self.separatorStyle! + } + } public func isSectionCollapsed(_ section: Int) -> Bool { if _sectionsState.index(forKey: section) == nil { From 6d23805dde4778e14655853991dfd070fed8dbae Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Sun, 31 Jan 2021 10:57:16 +0330 Subject: [PATCH 19/20] Added a register function to register cells for the tableview --- .../CollapsibleTableSectionViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index bff4fc8..9980249 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -60,6 +60,14 @@ open class CollapsibleTableSectionViewController: UIViewController { } } + /// Registers a class for use in creating new table cells. + /// - Parameters: + /// - cellClass: The class of a cell that you want to use in the table (must be a UITableViewCell subclass). + /// - identifier: The reuse identifier for the cell. This parameter must not be nil and must not be an empty string. + open func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String) { + self._tableView.register(cellClass, forCellReuseIdentifier: identifier) + } + public func isSectionCollapsed(_ section: Int) -> Bool { if _sectionsState.index(forKey: section) == nil { _sectionsState[section] = delegate?.shouldCollapseByDefault?(_tableView) ?? false From f1627546418a7ec6586cf6dcd866fea19df5b14c Mon Sep 17 00:00:00 2001 From: Arman Zoghi Date: Sun, 31 Jan 2021 11:43:18 +0330 Subject: [PATCH 20/20] no message --- .../CollapsibleTableSectionViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift index 9980249..4554495 100644 --- a/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift +++ b/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.swift @@ -59,6 +59,12 @@ open class CollapsibleTableSectionViewController: UIViewController { self._tableView.separatorStyle = self.separatorStyle! } } + /// A Boolean value that controls whether the vertical scroll indicator is visible. + open var showVerticalScrollIndicator = true { + didSet { + self._tableView.showsVerticalScrollIndicator = self.showVerticalScrollIndicator + } + } /// Registers a class for use in creating new table cells. /// - Parameters: