Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import UIKit
@objc optional func collapsibleTableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
@objc optional func collapsibleTableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
@objc optional func collapsibleTableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat
@objc optional func collapsibleTableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
@objc optional func collapsibleTableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
@objc optional func collapsibleTableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
@objc optional func shouldCollapseByDefault(_ tableView: UITableView) -> Bool
Expand Down Expand Up @@ -129,7 +130,10 @@ extension CollapsibleTableSectionViewController: UITableViewDataSource, UITableV
header.section = section
header.delegate = self

return header
guard let customHeader = delegate?.collapsibleTableView?(tableView, viewForHeaderInSection: section) as? CollapsibleTableViewHeader else { return header }
customHeader.section = section
customHeader.delegate = self
return customHeader
}

public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView {
var delegate: CollapsibleTableViewHeaderDelegate?
var section: Int = 0

let titleLabel = UILabel()
let arrowLabel = UILabel()
open var titleLabel = UILabel()
open var arrowLabel = UILabel()

override public init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)

private func initCommon() {
// Content View
contentView.backgroundColor = UIColor(hex: 0x2E3944)

Expand All @@ -36,7 +34,7 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView {
arrowLabel.topAnchor.constraint(equalTo: marginGuide.topAnchor).isActive = true
arrowLabel.trailingAnchor.constraint(equalTo: marginGuide.trailingAnchor).isActive = true
arrowLabel.bottomAnchor.constraint(equalTo: marginGuide.bottomAnchor).isActive = true

// Title label
contentView.addSubview(titleLabel)
titleLabel.textColor = UIColor.white
Expand All @@ -52,8 +50,14 @@ open class CollapsibleTableViewHeader: UITableViewHeaderFooterView {
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(CollapsibleTableViewHeader.tapHeader(_:))))
}

override public init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
initCommon()
}

required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
super.init(coder: aDecoder)
initCommon()
}

//
Expand Down
24 changes: 7 additions & 17 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
0AC886D81F226627007E4E2F /* Frameworks */,
0AC886D91F226627007E4E2F /* Resources */,
2B98B17FB368C4831B7977E1 /* [CP] Embed Pods Frameworks */,
C16092C4A63026D0FCAD40F1 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -188,9 +187,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Examples/Pods-Examples-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/CollapsibleTableSectionViewController/CollapsibleTableSectionViewController.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CollapsibleTableSectionViewController.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -203,28 +205,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Examples-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
C16092C4A63026D0FCAD40F1 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Examples/Pods-Examples-resources.sh\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
14 changes: 9 additions & 5 deletions Examples/Examples/CustomCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ class CustomCell: UITableViewCell {
let nameLabel = UILabel()
let detailLabel = UILabel()

// MARK: Initalizers
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

func initCommon() {
let marginGuide = contentView.layoutMarginsGuide

// configure nameLabel
Expand All @@ -41,8 +38,15 @@ class CustomCell: UITableViewCell {
detailLabel.textColor = UIColor.lightGray
}

// MARK: Initalizers
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
initCommon()
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
super.init(coder: aDecoder)
initCommon()
}

}
10 changes: 10 additions & 0 deletions Examples/Examples/CustomCellExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,14 @@ extension CustomCellExampleViewController: CollapsibleTableSectionDelegate {
return sections[section].name
}

func collapsibleTableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "header") as? CollapsibleTableViewHeader ??
CollapsibleTableViewHeader(reuseIdentifier: "header")
headerView.titleLabel.text = self.collapsibleTableView(tableView, titleForHeaderInSection: section)
headerView.titleLabel.textColor = .lightGray
headerView.contentView.backgroundColor = .darkGray

return headerView
}

}
6 changes: 3 additions & 3 deletions Examples/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- CollapsibleTableSectionViewController (0.0.7)
- CollapsibleTableSectionViewController (1.0.1)

DEPENDENCIES:
- CollapsibleTableSectionViewController (from `../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
CollapsibleTableSectionViewController: b56d6bd81f75dc1fd17ca3fb64b40b465f95586d
CollapsibleTableSectionViewController: 608df3a782355facc44e4ab140157d3afe191fb2

PODFILE CHECKSUM: b149b5d80e25f3d625e94e3d09cdfbe5a437add7

COCOAPODS: 1.2.1
COCOAPODS: 1.5.3

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

6 changes: 3 additions & 3 deletions Examples/Pods/Manifest.lock

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

Loading