Make project structure neat
Seto Elkahfi committed
Apr 8, 2017 at 17:04 UTC
e0b9ae34ee07c029700c9cccc7c13018b72a8739
13 files changed
+194
-90
Example/JomloTableView.xcodeproj/project.pbxproj
+36
-4
@@ -15,6 +15,10 @@
15
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
16
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
17
84CBD496B3AF199DDDFABEA5 /* Pods_JomloTableView_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02771B90736B785DC8EEE580 /* Pods_JomloTableView_Example.framework */; };
18
+ BD0F4E241E98E8AF001D0DA3 /* LoadMoreViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD0F4E231E98E8AF001D0DA3 /* LoadMoreViewController.swift */; };
19
+ BD14BB5E1E94E0C9006FB1B5 /* LoadMoreRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD14BB5D1E94E0C9006FB1B5 /* LoadMoreRow.swift */; };
20
+ BD14BB611E94E115006FB1B5 /* LoadMoreCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD14BB5F1E94E115006FB1B5 /* LoadMoreCell.swift */; };
21
+ BD14BB621E94E115006FB1B5 /* LoadMoreCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BD14BB601E94E115006FB1B5 /* LoadMoreCell.xib */; };
22
BDFF41491E8A871900D14CE7 /* SimpleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDFF41481E8A871900D14CE7 /* SimpleCell.swift */; };
23
BDFF414B1E8A873600D14CE7 /* SimpleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BDFF414A1E8A873600D14CE7 /* SimpleCell.xib */; };
24
/* End PBXBuildFile section */
@@ -47,8 +51,12 @@
51
B02AFC91A81D2EBF28A0B26F /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
52
B828666E6D8F9450941A36AB /* Pods-JomloTableView_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JomloTableView_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-JomloTableView_Example/Pods-JomloTableView_Example.release.xcconfig"; sourceTree = "<group>"; };
53
BAB533BC282592A3CAD7E959 /* JomloTableView.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = JomloTableView.podspec; path = ../JomloTableView.podspec; sourceTree = "<group>"; };
50
- BDFF41481E8A871900D14CE7 /* SimpleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleCell.swift; sourceTree = "<group>"; };
51
- BDFF414A1E8A873600D14CE7 /* SimpleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SimpleCell.xib; sourceTree = "<group>"; };
54
+ BD0F4E231E98E8AF001D0DA3 /* LoadMoreViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadMoreViewController.swift; sourceTree = "<group>"; };
55
+ BD14BB5D1E94E0C9006FB1B5 /* LoadMoreRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoadMoreRow.swift; path = Rows/LoadMoreRow.swift; sourceTree = "<group>"; };
56
+ BD14BB5F1E94E115006FB1B5 /* LoadMoreCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LoadMoreCell.swift; path = Rows/LoadMoreCell.swift; sourceTree = "<group>"; };
57
+ BD14BB601E94E115006FB1B5 /* LoadMoreCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = LoadMoreCell.xib; path = Rows/LoadMoreCell.xib; sourceTree = "<group>"; };
58
+ BDFF41481E8A871900D14CE7 /* SimpleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SimpleCell.swift; path = JomloTableView/Rows/SimpleCell.swift; sourceTree = SOURCE_ROOT; };
59
+ BDFF414A1E8A873600D14CE7 /* SimpleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SimpleCell.xib; path = Rows/SimpleCell.xib; sourceTree = "<group>"; };
60
D67A39B8BF2D4AB708B1879B /* Pods-JomloTableView_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JomloTableView_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-JomloTableView_Tests/Pods-JomloTableView_Tests.release.xcconfig"; sourceTree = "<group>"; };
61
E555BEE30E2659F27C50D6B8 /* Pods-JomloTableView_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JomloTableView_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JomloTableView_Tests/Pods-JomloTableView_Tests.debug.xcconfig"; sourceTree = "<group>"; };
62
/* End PBXFileReference section */
@@ -97,14 +105,14 @@
105
607FACD21AFB9204008FA782 /* Example for JomloTableView */ = {
106
isa = PBXGroup;
107
children = (
108
+ BD0F4E221E98E829001D0DA3 /* View Controllers */,
109
+ BD14BB5C1E94DFCE006FB1B5 /* Rows */,
110
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
111
607FACD71AFB9204008FA782 /* ViewController.swift */,
112
607FACD91AFB9204008FA782 /* Main.storyboard */,
113
607FACDC1AFB9204008FA782 /* Images.xcassets */,
114
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
115
607FACD31AFB9204008FA782 /* Supporting Files */,
106
- BDFF41481E8A871900D14CE7 /* SimpleCell.swift */,
107
- BDFF414A1E8A873600D14CE7 /* SimpleCell.xib */,
116
);
117
name = "Example for JomloTableView";
118
path = JomloTableView;
@@ -145,6 +153,26 @@
153
name = "Podspec Metadata";
154
sourceTree = "<group>";
155
};
156
+ BD0F4E221E98E829001D0DA3 /* View Controllers */ = {
157
+ isa = PBXGroup;
158
+ children = (
159
+ BD0F4E231E98E8AF001D0DA3 /* LoadMoreViewController.swift */,
160
+ );
161
+ name = "View Controllers";
162
+ sourceTree = "<group>";
163
+ };
164
+ BD14BB5C1E94DFCE006FB1B5 /* Rows */ = {
165
+ isa = PBXGroup;
166
+ children = (
167
+ BDFF41481E8A871900D14CE7 /* SimpleCell.swift */,
168
+ BDFF414A1E8A873600D14CE7 /* SimpleCell.xib */,
169
+ BD14BB5D1E94E0C9006FB1B5 /* LoadMoreRow.swift */,
170
+ BD14BB5F1E94E115006FB1B5 /* LoadMoreCell.swift */,
171
+ BD14BB601E94E115006FB1B5 /* LoadMoreCell.xib */,
172
+ );
173
+ name = Rows;
174
+ sourceTree = "<group>";
175
+ };
176
D468E008AD7F9DA36A194707 /* Frameworks */ = {
177
isa = PBXGroup;
178
children = (
@@ -257,6 +285,7 @@
285
buildActionMask = 2147483647;
286
files = (
287
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
288
+ BD14BB621E94E115006FB1B5 /* LoadMoreCell.xib in Resources */,
289
BDFF414B1E8A873600D14CE7 /* SimpleCell.xib in Resources */,
290
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
291
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
@@ -373,6 +402,9 @@
402
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
403
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
404
BDFF41491E8A871900D14CE7 /* SimpleCell.swift in Sources */,
405
+ BD0F4E241E98E8AF001D0DA3 /* LoadMoreViewController.swift in Sources */,
406
+ BD14BB611E94E115006FB1B5 /* LoadMoreCell.swift in Sources */,
407
+ BD14BB5E1E94E0C9006FB1B5 /* LoadMoreRow.swift in Sources */,
408
);
409
runOnlyForDeploymentPostprocessing = 0;
410
};
Example/JomloTableView/Base.lproj/Main.storyboard
+47
-25
@@ -1,47 +1,69 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="cMU-6A-sZN">
3
<device id="retina4_7" orientation="portrait">
4
<adaptation id="fullscreen"/>
5
</device>
6
<dependencies>
7
<deployment identifier="iOS"/>
8
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
9
- <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
9
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10
</dependencies>
11
<scenes>
13
- <!--View Controller-->
12
+ <!--JomloTableView-->
13
<scene sceneID="ufC-wZ-h7g">
14
<objects>
16
- <viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="JomloTableView_Example" customModuleProvider="target" sceneMemberID="viewController">
17
- <layoutGuides>
18
- <viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
19
- <viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
20
- </layoutGuides>
21
- <view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
15
+ <viewController title="JomloTableView" id="vXZ-lx-hvc" customClass="ViewController" customModule="JomloTableView_Example" customModuleProvider="target" sceneMemberID="viewController">
16
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="O58-cx-lFa" customClass="JomloTableView" customModule="JomloTableView">
17
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
18
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
24
- <subviews>
25
- <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Dvm-ui-hKc" customClass="JomloTableView" customModule="JomloTableView">
26
- <rect key="frame" x="16" y="20" width="343" height="647"/>
27
- <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
28
- </tableView>
29
- </subviews>
30
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
31
- <constraints>
32
- <constraint firstItem="Dvm-ui-hKc" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" id="4Ig-Cf-pF8"/>
33
- <constraint firstItem="Dvm-ui-hKc" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="D2s-ef-yeG"/>
34
- <constraint firstAttribute="trailingMargin" secondItem="Dvm-ui-hKc" secondAttribute="trailing" id="fe6-ZF-Bqy"/>
35
- <constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="Dvm-ui-hKc" secondAttribute="bottom" id="mM6-L5-CCp"/>
36
- </constraints>
37
- </view>
19
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
20
+ </tableView>
21
+ <navigationItem key="navigationItem" title="JomloTableView" id="82t-X7-det">
22
+ <barButtonItem key="backBarButtonItem" title="Back" id="EVO-cv-TLr"/>
23
+ </navigationItem>
24
<connections>
39
- <outlet property="jomloTableView" destination="Dvm-ui-hKc" id="pDK-ip-P1r"/>
25
+ <outlet property="jomloTableView" destination="O58-cx-lFa" id="EEN-ES-c87"/>
26
+ <segue destination="g32-7R-g4E" kind="show" identifier="showLoadMoreExample" id="yzC-EM-5kg"/>
27
</connections>
28
</viewController>
29
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
30
</objects>
44
- <point key="canvasLocation" x="117.59999999999999" y="122.78860569715144"/>
31
+ <point key="canvasLocation" x="1056.8" y="122.78860569715144"/>
32
+ </scene>
33
+ <!--Load More Example-->
34
+ <scene sceneID="xtz-2B-VF9">
35
+ <objects>
36
+ <viewController title="Load More Example" id="g32-7R-g4E" customClass="LoadMoreViewController" customModule="JomloTableView_Example" customModuleProvider="target" sceneMemberID="viewController">
37
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="rYm-wF-070">
38
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
39
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
40
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
41
+ </tableView>
42
+ <navigationItem key="navigationItem" title="LoadMore" id="7yA-oT-lrA">
43
+ <barButtonItem key="backBarButtonItem" title="Back" id="qOO-5C-71O"/>
44
+ </navigationItem>
45
+ </viewController>
46
+ <placeholder placeholderIdentifier="IBFirstResponder" id="DKX-6f-sJi" userLabel="First Responder" sceneMemberID="firstResponder"/>
47
+ </objects>
48
+ <point key="canvasLocation" x="1920.8" y="13.943028485757123"/>
49
+ </scene>
50
+ <!--Navigation Controller-->
51
+ <scene sceneID="Uo3-bN-yZx">
52
+ <objects>
53
+ <navigationController automaticallyAdjustsScrollViewInsets="NO" id="cMU-6A-sZN" sceneMemberID="viewController">
54
+ <toolbarItems/>
55
+ <navigationBar key="navigationBar" contentMode="scaleToFill" id="ULN-Vc-nzd">
56
+ <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
57
+ <autoresizingMask key="autoresizingMask"/>
58
+ </navigationBar>
59
+ <nil name="viewControllers"/>
60
+ <connections>
61
+ <segue destination="vXZ-lx-hvc" kind="relationship" relationship="rootViewController" id="uwR-Cb-Oeu"/>
62
+ </connections>
63
+ </navigationController>
64
+ <placeholder placeholderIdentifier="IBFirstResponder" id="9pm-MH-7gV" userLabel="First Responder" sceneMemberID="firstResponder"/>
65
+ </objects>
66
+ <point key="canvasLocation" x="-175" y="161"/>
67
</scene>
68
</scenes>
69
</document>
Example/JomloTableView/Rows/LoadMoreCell.swift
+4
-12
@@ -2,23 +2,15 @@
2
// LoadMoreCell.swift
3
// JomloTableView
4
//
5
-// Created by SDMobile on 4/5/17.
5
+// Created by Seto Elkahfi on 4/5/17.
6
// Copyright © 2017 CocoaPods. All rights reserved.
7
//
8
9
import UIKit
10
+import JomloTableView
11
11
-class LoadMoreCell: UITableViewCell {
12
+class LoadMoreCell: JomloTableViewCell {
13
13
- override func awakeFromNib() {
14
- super.awakeFromNib()
15
- // Initialization code
16
- }
17
-
18
- override func setSelected(_ selected: Bool, animated: Bool) {
19
- super.setSelected(selected, animated: animated)
20
-
21
- // Configure the view for the selected state
22
- }
14
+
15
16
}
Example/JomloTableView/Rows/LoadMoreCell.xib
+20
-6
@@ -1,19 +1,33 @@
1
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3
+ <device id="retina4_7" orientation="portrait">
4
+ <adaptation id="fullscreen"/>
5
+ </device>
6
<dependencies>
4
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
7
+ <deployment identifier="iOS"/>
8
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
9
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10
</dependencies>
11
<objects>
12
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
13
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="LoadMoreCell" customModuleProvider="target">
11
- <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
14
+ <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="LoadMoreCell" rowHeight="58" id="KGk-i7-Jjw" customClass="LoadMoreCell" customModule="JomloTableView_Example" customModuleProvider="target">
15
+ <rect key="frame" x="0.0" y="0.0" width="432" height="58"/>
16
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
17
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
14
- <frame key="frameInset" width="320" height="43"/>
18
+ <rect key="frame" x="0.0" y="0.0" width="432" height="58"/>
19
<autoresizingMask key="autoresizingMask"/>
20
+ <subviews>
21
+ <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="wXd-bK-aYS">
22
+ <rect key="frame" x="206" y="19" width="20" height="20"/>
23
+ </activityIndicatorView>
24
+ </subviews>
25
+ <constraints>
26
+ <constraint firstItem="wXd-bK-aYS" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="HWH-Vi-Udv"/>
27
+ <constraint firstItem="wXd-bK-aYS" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="z5V-UT-IqR"/>
28
+ </constraints>
29
</tableViewCellContentView>
30
+ <point key="canvasLocation" x="82" y="59"/>
31
</tableViewCell>
32
</objects>
33
</document>
Example/JomloTableView/Rows/LoadMoreRow.swift
+12
@@ -7,3 +7,15 @@
7
//
8
9
import Foundation
10
+import JomloTableView
11
+
12
+class LoadMoreRow: JomloTableViewRow {
13
+
14
+
15
+ override var rowHeight: CGFloat {
16
+ return 62
17
+ }
18
+
19
+
20
+
21
+}
Example/JomloTableView/Rows/SimpleCell.swift
renamed
+10
-8
@@ -11,18 +11,19 @@ import JomloTableView
11
12
class SimpleCell: JomloTableViewCell {
13
14
- /*
15
- // Only override draw() if you perform custom drawing.
16
- // An empty implementation adversely affects performance during animation.
17
- override func draw(_ rect: CGRect) {
18
- // Drawing code
19
- }
20
- */
14
+ @IBOutlet var textlabel: UILabel!
15
16
}
17
18
class SimpleRow: JomloTableViewRow {
19
20
+ var text: String!
21
+
22
+ init(_ text: String) {
23
+ self.text = text
24
+ }
25
+
26
+
27
override var identifier: String {
28
return "SimpleCell"
29
}
@@ -36,7 +37,8 @@ class SimpleRow: JomloTableViewRow {
37
}
38
39
override func populateView(cell: JomloTableViewCell) {
39
-
40
+ let cell = cell as! SimpleCell
41
+ cell.textlabel.text = text
42
}
43
44
}
Example/JomloTableView/Rows/SimpleCell.xib
renamed
+4
-1
@@ -14,7 +14,7 @@
14
<rect key="frame" x="0.0" y="0.0" width="584" height="93"/>
15
<autoresizingMask key="autoresizingMask"/>
16
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Jxp-d1-zT1" id="150-Wq-GWr">
17
- <rect key="frame" x="0.0" y="0.0" width="584" height="93"/>
17
+ <rect key="frame" x="0.0" y="0.0" width="584" height="92"/>
18
<autoresizingMask key="autoresizingMask"/>
19
<subviews>
20
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SimpleRow" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUm-db-ewC">
@@ -29,6 +29,9 @@
29
<constraint firstItem="fUm-db-ewC" firstAttribute="centerX" secondItem="150-Wq-GWr" secondAttribute="centerX" id="WpU-N7-rLz"/>
30
</constraints>
31
</tableViewCellContentView>
32
+ <connections>
33
+ <outlet property="textlabel" destination="fUm-db-ewC" id="uhd-rH-Xuq"/>
34
+ </connections>
35
<point key="canvasLocation" x="138" y="83.5"/>
36
</tableViewCell>
37
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
Example/JomloTableView/ViewController.swift
+24
-13
@@ -17,19 +17,30 @@ class ViewController: UIViewController {
17
18
override func viewDidLoad() {
19
super.viewDidLoad()
20
- // Do any additional setup after loading the view, typically from a nib.
21
-
22
- let row = SimpleRow()
23
-
24
- exampleSection.addRow(row: row)
25
- exampleSection.addRow(row: row)
26
- exampleSection.addRow(row: row)
27
- exampleSection.addRow(row: row)
28
- exampleSection.addRow(row: row)
29
- exampleSection.addRow(row: row)
30
- exampleSection.addRow(row: row)
31
- exampleSection.addRow(row: row)
32
- exampleSection.addRow(row: row)
20
+
21
+ let row0 = SimpleRow("Simple table view")
22
+ exampleSection.addRow(row: row0)
23
+
24
+ let row1 = SimpleRow("Load more")
25
+ row1.setOnRowClicked { (row) in
26
+ self.performSegue(withIdentifier: "showLoadMoreExample", sender: self)
27
+ }
28
+ exampleSection.addRow(row: row1)
29
+
30
+ let row2 = SimpleRow("Dynamic height")
31
+ exampleSection.addRow(row: row2)
32
+
33
+ let row3 = SimpleRow("WebView")
34
+ exampleSection.addRow(row: row3)
35
+
36
+ let row4 = SimpleRow("Image list")
37
+ exampleSection.addRow(row: row4)
38
+
39
+ let row5 = SimpleRow("Long scrollable layout")
40
+ exampleSection.addRow(row: row5)
41
+
42
+ let row6 = SimpleRow("StackView row")
43
+ exampleSection.addRow(row: row6)
44
45
jomloTableView.addSection(section: exampleSection)
46
jomloTableView.reloadData()
JomloTableView.podspec
+2
-2
@@ -24,9 +24,9 @@ JomloTableView uses detachable section and row. You can add multiple section ind
24
s.homepage = 'https://github.com/setoelkahfi/JomloTableView'
25
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
26
s.license = { :type => 'MIT', :file => 'LICENSE' }
27
- s.author = { 'setoelkahfi' => 'setoelkahfi@gmail.com' }
27
+ s.author = { 'Seto Elkahfi' => 'setoelkahfi@gmail.com' }
28
s.source = { :git => 'https://github.com/setoelkahfi/JomloTableView.git', :tag => s.version.to_s }
29
- # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
29
+ s.social_media_url = 'https://twitter.com/setoelkahfi'
30
31
s.ios.deployment_target = '8.0'
32
JomloTableView/Classes/JomloTableView.swift
+5
-4
@@ -16,11 +16,12 @@ public class JomloTableView: UITableView {
16
required public init?(coder aDecoder: NSCoder) {
17
super.init(coder: aDecoder)
18
19
- self.delegate = self
20
- self.dataSource = self
21
- self.tableFooterView = UIView()
19
+ delegate = self
20
+ dataSource = self
21
+ tableFooterView = UIView()
22
}
23
24
+ // Count all section in this table view
25
public func numberOfSectionsInTableView(tableView: UITableView) -> Int {
26
return sections.count
27
}
@@ -49,7 +50,7 @@ extension JomloTableView: UITableViewDelegate {
50
51
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
52
let item = sections[indexPath.section].rows[indexPath.row]
52
- item.onItemClicked()
53
+ item.onRowClicked()
54
}
55
56
public func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
JomloTableView/Classes/JomloTableViewRow.swift
+18
-11
@@ -10,38 +10,45 @@ import Foundation
10
11
open class JomloTableViewRow: NSObject {
12
13
+ // Callback for on row clicked.
14
+ // Use IBAction on single view component if you need to
15
+ // register action for a particular view inside the row.
16
+ internal var callback: ((JomloTableViewRow) -> (Void))?
17
+
18
+ // An identifier of JomloTableViewCell.
19
open var identifier: String {
20
return ""
21
}
22
23
+ // Actual height of this row
24
+ // Use UITableViewAutomaticDimension to set the height dynamically
25
open var rowHeight: CGFloat {
26
return 0
27
}
28
29
+ // Height estimation for this row
30
open var estimatedRowHeight: CGFloat {
31
return 0
32
}
33
25
- // Callback for on row clicked.
26
- // Use IBAction on single view componen if you need to register action for a particular view inside the row
27
- internal var onClicked: ((JomloTableViewRow) -> (Void))?
28
-
29
- open func setOnItemClickedCallback(clicked:@escaping (JomloTableViewRow) -> Void){
30
- onClicked = clicked
34
+ open func setOnRowClicked(_ callback: @escaping (JomloTableViewRow) -> Void){
35
+ self.callback = callback
36
}
37
33
-
38
+ // The subclass must override this method.
39
+ // Otherwise, we throw error.
40
open func populateView(cell: JomloTableViewCell) {
35
- fatalError("Should be overrided")
41
+ fatalError("Must be overrided")
42
}
43
44
open func willDisplay(cell: UITableViewCell){
45
cell.separatorInset = UIEdgeInsetsMake(0, 6, 0, 6)
46
}
47
42
- open func onItemClicked() {
43
- if let clicked = onClicked {
44
- clicked(self)
48
+ // Call the callback
49
+ open func onRowClicked() {
50
+ if let callback = callback {
51
+ callback(self)
52
}
53
}
54
JomloTableView/Classes/JomloTableViewSection.swift
+11
-3
@@ -2,7 +2,7 @@
2
// JomloTableViewSection.swift
3
// Pods
4
//
5
-// Created by SDMobile on 3/27/17.
5
+// Created by Seto Elkahfi on 3/27/17.
6
//
7
//
8
@@ -10,13 +10,21 @@ import Foundation
10
11
public class JomloTableViewSection {
12
13
- var rows = Array<JomloTableViewRow>()
13
+ /**
14
+ Internal array of rows in this section.
15
+ **/
16
+ internal var rows = Array<JomloTableViewRow>()
17
18
+ /**
19
+ The only initializer required for this class. It needs to explicitly declared as public so can be initialized from outside module.
20
+ **/
21
public init() {
22
23
}
24
19
- // Count rows in this table view section
25
+ /**
26
+ Computed property to count rows in this section.
27
+ **/
28
public var count: Int {
29
get {
30
return rows.count
README.md
+1
-1
@@ -65,7 +65,7 @@ class ViewController: UIViewController {
65
66
## Author
67
68
-setoelkahfi, setoelkahfi@gmail.com
68
+Seto Elkahfi, setoelkahfi@gmail.com
69
70
## License
71