First working sample project

Seto Elkahfi committed Mar 28, 2017 at 19:26 UTC 6c6a3acb0e1ce2291b407832127e20d6cab7c5e9
5 files changed +106 -18
Example/JomloTableView/Base.lproj/LaunchScreen.xib
+9 -4
@@ -1,8 +1,13 @@
1 -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="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" launchScreen="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="6207"/>
7 + <deployment identifier="iOS"/>
8 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
9 <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
10 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
11 </dependencies>
12 <objects>
13 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -24,7 +29,7 @@
29 <nil key="highlightedColor"/>
30 </label>
31 </subviews>
27 - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
32 + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
33 <constraints>
34 <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
35 <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Example/JomloTableView/Base.lproj/Main.storyboard
+28 -6
@@ -1,25 +1,47 @@
1 -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
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">
3 + <device id="retina4_7" orientation="portrait">
4 + <adaptation id="fullscreen"/>
5 + </device>
6 <dependencies>
4 - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
7 + <deployment identifier="iOS"/>
8 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
9 + <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
10 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
11 </dependencies>
12 <scenes>
13 <!--View Controller-->
14 <scene sceneID="ufC-wZ-h7g">
15 <objects>
10 - <viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
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">
16 - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
22 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
23 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18 - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
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>
38 + <connections>
39 + <outlet property="jomloTableView" destination="Dvm-ui-hKc" id="pDK-ip-P1r"/>
40 + </connections>
41 </viewController>
42 <placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
43 </objects>
44 + <point key="canvasLocation" x="117.59999999999999" y="122.78860569715144"/>
45 </scene>
46 </scenes>
47 </document>
Example/JomloTableView/SimpleCell.swift
+21
@@ -7,6 +7,7 @@
7 //
8
9 import UIKit
10 +import JomloTableView
11
12 class SimpleCell: JomloTableViewCell {
13
@@ -19,3 +20,23 @@ class SimpleCell: JomloTableViewCell {
20 */
21
22 }
23 +
24 +class SimpleRow: JomloTableViewRow {
25 +
26 + override var identifier: String {
27 + return "SimpleCell"
28 + }
29 +
30 + override var rowHeight: CGFloat {
31 + return 80
32 + }
33 +
34 + override var estimatedRowHeight: CGFloat {
35 + return 80
36 + }
37 +
38 + override func populateView(cell: JomloTableViewCell) {
39 +
40 + }
41 +
42 +}
Example/JomloTableView/SimpleCell.xib
+28 -8
@@ -1,16 +1,36 @@
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 + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SimpleCell" rowHeight="93" id="Jxp-d1-zT1" customClass="SimpleCell" customModule="JomloTableView_Example" customModuleProvider="target">
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"/>
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">
21 + <rect key="frame" x="244.5" y="36" width="96.5" height="21"/>
22 + <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
23 + <nil key="textColor"/>
24 + <nil key="highlightedColor"/>
25 + </label>
26 + </subviews>
27 + <constraints>
28 + <constraint firstItem="fUm-db-ewC" firstAttribute="centerY" secondItem="150-Wq-GWr" secondAttribute="centerY" id="1Ky-R2-nPS"/>
29 + <constraint firstItem="fUm-db-ewC" firstAttribute="centerX" secondItem="150-Wq-GWr" secondAttribute="centerX" id="WpU-N7-rLz"/>
30 + </constraints>
31 + </tableViewCellContentView>
32 + <point key="canvasLocation" x="138" y="83.5"/>
33 + </tableViewCell>
34 <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10 - <view contentMode="scaleToFill" id="iN0-l3-epB">
11 - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
12 - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13 - <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
14 - </view>
35 </objects>
36 </document>
Example/JomloTableView/ViewController.swift
+20
@@ -10,10 +10,30 @@ import UIKit
10 import JomloTableView
11
12 class ViewController: UIViewController {
13 +
14 + @IBOutlet var jomloTableView: JomloTableView!
15 +
16 + var exampleSection = JomloTableViewSection()
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)
33 +
34 + jomloTableView.addSection(section: exampleSection)
35 + jomloTableView.reloadData()
36 +
37 }
38
39 override func didReceiveMemoryWarning() {