Skip to content

Commit ce21e3e

Browse files
committed
Example project uses pod.
1 parent 1aa7b5c commit ce21e3e

26 files changed

Lines changed: 1187 additions & 40 deletions

Classes/CollapsibleTableSectionViewController.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ import UIKit
1111
//
1212
// MARK: - Section Data Structure
1313
//
14-
struct Item {
14+
public struct Item {
1515
var name: String
1616
var detail: String
1717

18-
init(name: String, detail: String) {
18+
public init(name: String, detail: String) {
1919
self.name = name
2020
self.detail = detail
2121
}
2222
}
2323

24-
struct Section {
24+
public struct Section {
2525
var name: String
2626
var items: [Item]
2727
var collapsed: Bool
2828

29-
init(name: String, items: [Item], collapsed: Bool = false) {
29+
public init(name: String, items: [Item], collapsed: Bool = false) {
3030
self.name = name
3131
self.items = items
3232
self.collapsed = collapsed
@@ -36,11 +36,11 @@ struct Section {
3636
//
3737
// MARK: - View Controller
3838
//
39-
class CollapsibleTableSectionViewController: UITableViewController {
39+
open class CollapsibleTableSectionViewController: UITableViewController {
4040

41-
var sections = [Section]()
41+
open var sections = [Section]()
4242

43-
override func viewDidLoad() {
43+
override open func viewDidLoad() {
4444
super.viewDidLoad()
4545

4646
// Auto resizing the height of the cell
@@ -55,16 +55,16 @@ class CollapsibleTableSectionViewController: UITableViewController {
5555
//
5656
extension CollapsibleTableSectionViewController {
5757

58-
override func numberOfSections(in tableView: UITableView) -> Int {
58+
override open func numberOfSections(in tableView: UITableView) -> Int {
5959
return sections.count
6060
}
6161

62-
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
62+
override open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
6363
return sections[section].collapsed ? 0 : sections[section].items.count
6464
}
6565

6666
// Cell
67-
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
67+
override open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
6868
let cell: CollapsibleTableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as? CollapsibleTableViewCell ??
6969
CollapsibleTableViewCell(style: .default, reuseIdentifier: "cell")
7070

@@ -76,12 +76,12 @@ extension CollapsibleTableSectionViewController {
7676
return cell
7777
}
7878

79-
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
79+
override open func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
8080
return sections[(indexPath as NSIndexPath).section].collapsed ? 0 : UITableViewAutomaticDimension
8181
}
8282

8383
// Header
84-
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
84+
override open func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
8585
let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: "header") as? CollapsibleTableViewHeader ?? CollapsibleTableViewHeader(reuseIdentifier: "header")
8686

8787
header.titleLabel.text = sections[section].name
@@ -94,11 +94,11 @@ extension CollapsibleTableSectionViewController {
9494
return header
9595
}
9696

97-
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
97+
override open func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
9898
return 44.0
9999
}
100100

101-
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
101+
override open func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
102102
return 1.0
103103
}
104104

CollapsibleTableSectionViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "CollapsibleTableSectionViewController"
19-
s.version = "0.0.5"
19+
s.version = "0.0.6"
2020
s.summary = "Swift 3.0 library to support collapsible sections in a table view."
2121

2222
# This description is used to generate tags and improve search results.

Examples/Examples.xcodeproj/project.pbxproj

Lines changed: 77 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,46 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
0A8BD6401F229BD4003D6155 /* CollapsibleTableSectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8BD63C1F229BD4003D6155 /* CollapsibleTableSectionViewController.swift */; };
11-
0A8BD6411F229BD4003D6155 /* CollapsibleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8BD63D1F229BD4003D6155 /* CollapsibleTableViewCell.swift */; };
12-
0A8BD6421F229BD4003D6155 /* CollapsibleTableViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8BD63E1F229BD4003D6155 /* CollapsibleTableViewHeader.swift */; };
13-
0A8BD6431F229BD4003D6155 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8BD63F1F229BD4003D6155 /* Extensions.swift */; };
1410
0AC886DF1F226627007E4E2F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AC886DE1F226627007E4E2F /* AppDelegate.swift */; };
1511
0AC886E11F226627007E4E2F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AC886E01F226627007E4E2F /* ViewController.swift */; };
1612
0AC886E41F226627007E4E2F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0AC886E21F226627007E4E2F /* Main.storyboard */; };
1713
0AC886E61F226627007E4E2F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0AC886E51F226627007E4E2F /* Assets.xcassets */; };
1814
0AC886E91F226627007E4E2F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0AC886E71F226627007E4E2F /* LaunchScreen.storyboard */; };
15+
1954D61128E2AEA6960297AB /* Pods_Examples.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 540185A9FAB3B385AE8ED8A6 /* Pods_Examples.framework */; };
1916
/* End PBXBuildFile section */
2017

2118
/* Begin PBXFileReference section */
22-
0A8BD63C1F229BD4003D6155 /* CollapsibleTableSectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CollapsibleTableSectionViewController.swift; path = ../../Classes/CollapsibleTableSectionViewController.swift; sourceTree = "<group>"; };
23-
0A8BD63D1F229BD4003D6155 /* CollapsibleTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CollapsibleTableViewCell.swift; path = ../../Classes/CollapsibleTableViewCell.swift; sourceTree = "<group>"; };
24-
0A8BD63E1F229BD4003D6155 /* CollapsibleTableViewHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CollapsibleTableViewHeader.swift; path = ../../Classes/CollapsibleTableViewHeader.swift; sourceTree = "<group>"; };
25-
0A8BD63F1F229BD4003D6155 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = ../../Classes/Extensions.swift; sourceTree = "<group>"; };
2619
0AC886DB1F226627007E4E2F /* Examples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Examples.app; sourceTree = BUILT_PRODUCTS_DIR; };
2720
0AC886DE1F226627007E4E2F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2821
0AC886E01F226627007E4E2F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
2922
0AC886E31F226627007E4E2F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
3023
0AC886E51F226627007E4E2F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3124
0AC886E81F226627007E4E2F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
3225
0AC886EA1F226627007E4E2F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
26+
3C62BC05B19E169D1565F49A /* Pods-Examples.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Examples.release.xcconfig"; path = "Pods/Target Support Files/Pods-Examples/Pods-Examples.release.xcconfig"; sourceTree = "<group>"; };
27+
540185A9FAB3B385AE8ED8A6 /* Pods_Examples.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Examples.framework; sourceTree = BUILT_PRODUCTS_DIR; };
28+
9A48C72D331DE20192DED484 /* Pods-Examples.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Examples.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Examples/Pods-Examples.debug.xcconfig"; sourceTree = "<group>"; };
3329
/* End PBXFileReference section */
3430

3531
/* Begin PBXFrameworksBuildPhase section */
3632
0AC886D81F226627007E4E2F /* Frameworks */ = {
3733
isa = PBXFrameworksBuildPhase;
3834
buildActionMask = 2147483647;
3935
files = (
36+
1954D61128E2AEA6960297AB /* Pods_Examples.framework in Frameworks */,
4037
);
4138
runOnlyForDeploymentPostprocessing = 0;
4239
};
4340
/* End PBXFrameworksBuildPhase section */
4441

4542
/* Begin PBXGroup section */
46-
0A8BD63B1F229BB6003D6155 /* Classes */ = {
47-
isa = PBXGroup;
48-
children = (
49-
0A8BD63C1F229BD4003D6155 /* CollapsibleTableSectionViewController.swift */,
50-
0A8BD63D1F229BD4003D6155 /* CollapsibleTableViewCell.swift */,
51-
0A8BD63E1F229BD4003D6155 /* CollapsibleTableViewHeader.swift */,
52-
0A8BD63F1F229BD4003D6155 /* Extensions.swift */,
53-
);
54-
name = Classes;
55-
path = Examples;
56-
sourceTree = "<group>";
57-
};
5843
0AC886D21F226627007E4E2F = {
5944
isa = PBXGroup;
6045
children = (
61-
0A8BD63B1F229BB6003D6155 /* Classes */,
6246
0AC886DD1F226627007E4E2F /* Examples */,
6347
0AC886DC1F226627007E4E2F /* Products */,
48+
F50AF0A7224297DBF5B5786D /* Pods */,
49+
823E10AC88D78C64927963B2 /* Frameworks */,
6450
);
6551
sourceTree = "<group>";
6652
};
@@ -85,16 +71,36 @@
8571
path = Examples;
8672
sourceTree = "<group>";
8773
};
74+
823E10AC88D78C64927963B2 /* Frameworks */ = {
75+
isa = PBXGroup;
76+
children = (
77+
540185A9FAB3B385AE8ED8A6 /* Pods_Examples.framework */,
78+
);
79+
name = Frameworks;
80+
sourceTree = "<group>";
81+
};
82+
F50AF0A7224297DBF5B5786D /* Pods */ = {
83+
isa = PBXGroup;
84+
children = (
85+
9A48C72D331DE20192DED484 /* Pods-Examples.debug.xcconfig */,
86+
3C62BC05B19E169D1565F49A /* Pods-Examples.release.xcconfig */,
87+
);
88+
name = Pods;
89+
sourceTree = "<group>";
90+
};
8891
/* End PBXGroup section */
8992

9093
/* Begin PBXNativeTarget section */
9194
0AC886DA1F226627007E4E2F /* Examples */ = {
9295
isa = PBXNativeTarget;
9396
buildConfigurationList = 0AC886ED1F226627007E4E2F /* Build configuration list for PBXNativeTarget "Examples" */;
9497
buildPhases = (
98+
67BC9FB4010BB81E14931700 /* [CP] Check Pods Manifest.lock */,
9599
0AC886D71F226627007E4E2F /* Sources */,
96100
0AC886D81F226627007E4E2F /* Frameworks */,
97101
0AC886D91F226627007E4E2F /* Resources */,
102+
2B98B17FB368C4831B7977E1 /* [CP] Embed Pods Frameworks */,
103+
C16092C4A63026D0FCAD40F1 /* [CP] Copy Pods Resources */,
98104
);
99105
buildRules = (
100106
);
@@ -153,16 +159,60 @@
153159
};
154160
/* End PBXResourcesBuildPhase section */
155161

162+
/* Begin PBXShellScriptBuildPhase section */
163+
2B98B17FB368C4831B7977E1 /* [CP] Embed Pods Frameworks */ = {
164+
isa = PBXShellScriptBuildPhase;
165+
buildActionMask = 2147483647;
166+
files = (
167+
);
168+
inputPaths = (
169+
);
170+
name = "[CP] Embed Pods Frameworks";
171+
outputPaths = (
172+
);
173+
runOnlyForDeploymentPostprocessing = 0;
174+
shellPath = /bin/sh;
175+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Examples/Pods-Examples-frameworks.sh\"\n";
176+
showEnvVarsInLog = 0;
177+
};
178+
67BC9FB4010BB81E14931700 /* [CP] Check Pods Manifest.lock */ = {
179+
isa = PBXShellScriptBuildPhase;
180+
buildActionMask = 2147483647;
181+
files = (
182+
);
183+
inputPaths = (
184+
);
185+
name = "[CP] Check Pods Manifest.lock";
186+
outputPaths = (
187+
);
188+
runOnlyForDeploymentPostprocessing = 0;
189+
shellPath = /bin/sh;
190+
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";
191+
showEnvVarsInLog = 0;
192+
};
193+
C16092C4A63026D0FCAD40F1 /* [CP] Copy Pods Resources */ = {
194+
isa = PBXShellScriptBuildPhase;
195+
buildActionMask = 2147483647;
196+
files = (
197+
);
198+
inputPaths = (
199+
);
200+
name = "[CP] Copy Pods Resources";
201+
outputPaths = (
202+
);
203+
runOnlyForDeploymentPostprocessing = 0;
204+
shellPath = /bin/sh;
205+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Examples/Pods-Examples-resources.sh\"\n";
206+
showEnvVarsInLog = 0;
207+
};
208+
/* End PBXShellScriptBuildPhase section */
209+
156210
/* Begin PBXSourcesBuildPhase section */
157211
0AC886D71F226627007E4E2F /* Sources */ = {
158212
isa = PBXSourcesBuildPhase;
159213
buildActionMask = 2147483647;
160214
files = (
161-
0A8BD6421F229BD4003D6155 /* CollapsibleTableViewHeader.swift in Sources */,
162-
0A8BD6431F229BD4003D6155 /* Extensions.swift in Sources */,
163-
0A8BD6401F229BD4003D6155 /* CollapsibleTableSectionViewController.swift in Sources */,
164215
0AC886E11F226627007E4E2F /* ViewController.swift in Sources */,
165-
0A8BD6411F229BD4003D6155 /* CollapsibleTableViewCell.swift in Sources */,
166216
0AC886DF1F226627007E4E2F /* AppDelegate.swift in Sources */,
167217
);
168218
runOnlyForDeploymentPostprocessing = 0;
@@ -286,6 +336,7 @@
286336
};
287337
0AC886EE1F226627007E4E2F /* Debug */ = {
288338
isa = XCBuildConfiguration;
339+
baseConfigurationReference = 9A48C72D331DE20192DED484 /* Pods-Examples.debug.xcconfig */;
289340
buildSettings = {
290341
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
291342
DEVELOPMENT_TEAM = DJEZ3HHH6P;
@@ -300,6 +351,7 @@
300351
};
301352
0AC886EF1F226627007E4E2F /* Release */ = {
302353
isa = XCBuildConfiguration;
354+
baseConfigurationReference = 3C62BC05B19E169D1565F49A /* Pods-Examples.release.xcconfig */;
303355
buildSettings = {
304356
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
305357
DEVELOPMENT_TEAM = DJEZ3HHH6P;

Examples/Examples.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/Examples/ViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import UIKit
10+
import CollapsibleTableSectionViewController
1011

1112
class ViewController: UIViewController {
1213

Examples/Podfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Uncomment the next line to define a global platform for your project
2+
platform :ios, '9.0'
3+
4+
target 'Examples' do
5+
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6+
use_frameworks!
7+
8+
# Pods for Examples
9+
pod 'CollapsibleTableSectionViewController', :path => '../'
10+
11+
end

Examples/Podfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
PODS:
2+
- CollapsibleTableSectionViewController (0.0.5)
3+
4+
DEPENDENCIES:
5+
- CollapsibleTableSectionViewController (from `../`)
6+
7+
EXTERNAL SOURCES:
8+
CollapsibleTableSectionViewController:
9+
:path: "../"
10+
11+
SPEC CHECKSUMS:
12+
CollapsibleTableSectionViewController: a9da9daef5cdea2b0c5830493f5c66509457edb8
13+
14+
PODFILE CHECKSUM: b149b5d80e25f3d625e94e3d09cdfbe5a437add7
15+
16+
COCOAPODS: 1.2.1

Examples/Pods/Local Podspecs/CollapsibleTableSectionViewController.podspec.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/Pods/Manifest.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)