Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4925447

Browse files
author
gunm
committedMar 12, 2018
Todo list complete with datasource and delegate methods
1 parent 421f564 commit 4925447

File tree

5 files changed

+103
-43
lines changed

5 files changed

+103
-43
lines changed
 

‎Ziel Todo.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
B6E56E9620560955000E192C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E56E9520560955000E192C /* AppDelegate.swift */; };
11-
B6E56E9820560955000E192C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E56E9720560955000E192C /* ViewController.swift */; };
11+
B6E56E9820560955000E192C /* TodoListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E56E9720560955000E192C /* TodoListViewController.swift */; };
1212
B6E56E9B20560955000E192C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B6E56E9920560955000E192C /* Main.storyboard */; };
1313
B6E56E9D20560955000E192C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B6E56E9C20560955000E192C /* Assets.xcassets */; };
1414
B6E56EA020560955000E192C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B6E56E9E20560955000E192C /* LaunchScreen.storyboard */; };
@@ -17,7 +17,7 @@
1717
/* Begin PBXFileReference section */
1818
B6E56E9220560955000E192C /* Ziel Todo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Ziel Todo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1919
B6E56E9520560955000E192C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
20-
B6E56E9720560955000E192C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
20+
B6E56E9720560955000E192C /* TodoListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoListViewController.swift; sourceTree = "<group>"; };
2121
B6E56E9A20560955000E192C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2222
B6E56E9C20560955000E192C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2323
B6E56E9F20560955000E192C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
@@ -55,7 +55,7 @@
5555
isa = PBXGroup;
5656
children = (
5757
B6E56E9520560955000E192C /* AppDelegate.swift */,
58-
B6E56E9720560955000E192C /* ViewController.swift */,
58+
B6E56E9720560955000E192C /* TodoListViewController.swift */,
5959
B6E56E9920560955000E192C /* Main.storyboard */,
6060
B6E56E9C20560955000E192C /* Assets.xcassets */,
6161
B6E56E9E20560955000E192C /* LaunchScreen.storyboard */,
@@ -136,7 +136,7 @@
136136
isa = PBXSourcesBuildPhase;
137137
buildActionMask = 2147483647;
138138
files = (
139-
B6E56E9820560955000E192C /* ViewController.swift in Sources */,
139+
B6E56E9820560955000E192C /* TodoListViewController.swift in Sources */,
140140
B6E56E9620560955000E192C /* AppDelegate.swift in Sources */,
141141
);
142142
runOnlyForDeploymentPostprocessing = 0;

‎Ziel Todo/Base.lproj/Main.storyboard

+52-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,64 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="vIT-zT-A2I">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5-
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
69
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
710
</dependencies>
811
<scenes>
9-
<!--View Controller-->
10-
<scene sceneID="tne-QT-ifu">
12+
<!--Todoey-->
13+
<scene sceneID="Yd7-hs-CBz">
1114
<objects>
12-
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
13-
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
15+
<tableViewController id="D1h-sY-cPR" customClass="TodoListViewController" customModule="Ziel_Todo" customModuleProvider="target" sceneMemberID="viewController">
16+
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="r8C-sd-PUa">
1417
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1518
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16-
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
17-
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18-
</view>
19-
</viewController>
20-
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
19+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
20+
<prototypes>
21+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ToDoItemCell" id="1OK-7a-zoM">
22+
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
23+
<autoresizingMask key="autoresizingMask"/>
24+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="1OK-7a-zoM" id="Tae-bh-x2E">
25+
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
26+
<autoresizingMask key="autoresizingMask"/>
27+
</tableViewCellContentView>
28+
</tableViewCell>
29+
</prototypes>
30+
<connections>
31+
<outlet property="dataSource" destination="D1h-sY-cPR" id="KOi-tj-OUF"/>
32+
<outlet property="delegate" destination="D1h-sY-cPR" id="AIr-xu-jlC"/>
33+
</connections>
34+
</tableView>
35+
<navigationItem key="navigationItem" title="Todoey" id="Tue-vN-qRX"/>
36+
</tableViewController>
37+
<placeholder placeholderIdentifier="IBFirstResponder" id="YrO-dz-N7J" userLabel="First Responder" sceneMemberID="firstResponder"/>
2138
</objects>
39+
<point key="canvasLocation" x="582" y="-54"/>
40+
</scene>
41+
<!--Navigation Controller-->
42+
<scene sceneID="rWP-ab-6eg">
43+
<objects>
44+
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="vIT-zT-A2I" sceneMemberID="viewController">
45+
<toolbarItems/>
46+
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="h97-g9-fWk">
47+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
48+
<autoresizingMask key="autoresizingMask"/>
49+
<color key="barTintColor" red="0.14055207778031464" green="0.68205508338132215" blue="0.71994549036026001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
50+
<textAttributes key="titleTextAttributes">
51+
<color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
52+
</textAttributes>
53+
</navigationBar>
54+
<nil name="viewControllers"/>
55+
<connections>
56+
<segue destination="D1h-sY-cPR" kind="relationship" relationship="rootViewController" id="ak6-Vg-TWc"/>
57+
</connections>
58+
</navigationController>
59+
<placeholder placeholderIdentifier="IBFirstResponder" id="k1S-Bz-qE8" userLabel="First Responder" sceneMemberID="firstResponder"/>
60+
</objects>
61+
<point key="canvasLocation" x="-143" y="-54"/>
2262
</scene>
2363
</scenes>
2464
</document>

‎Ziel Todo/Info.plist

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
<key>UISupportedInterfaceOrientations</key>
3232
<array>
3333
<string>UIInterfaceOrientationPortrait</string>
34-
<string>UIInterfaceOrientationLandscapeLeft</string>
35-
<string>UIInterfaceOrientationLandscapeRight</string>
3634
</array>
3735
<key>UISupportedInterfaceOrientations~ipad</key>
3836
<array>
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// ViewController.swift
3+
// Ziel Todo
4+
//
5+
// Created by gunm on 12/03/18.
6+
// Copyright © 2018 Gunaseelan. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class TodoListViewController: UITableViewController {
12+
13+
let itemArray = ["Raise PR for Bug ID", "DO code clean", "Compoenent changes for DNAC", "Do DNAC Setup"]
14+
15+
override func viewDidLoad() {
16+
super.viewDidLoad()
17+
}
18+
19+
// MARK - Table View Datasource Method
20+
21+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
22+
return itemArray.count
23+
}
24+
25+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
26+
let cell = tableView.dequeueReusableCell(withIdentifier: "ToDoItemCell", for: indexPath)
27+
cell.textLabel?.text = itemArray[indexPath.row]
28+
return cell
29+
}
30+
31+
// MARK - Table View Deletegate Method
32+
33+
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
34+
// print(itemArray[indexPath.row])
35+
36+
if tableView.cellForRow(at: indexPath)?.accessoryType == .checkmark {
37+
tableView.cellForRow(at: indexPath)?.accessoryType = .none
38+
}else {
39+
tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark
40+
}
41+
tableView.deselectRow(at: indexPath, animated: true)
42+
}
43+
44+
45+
46+
}
47+

‎Ziel Todo/ViewController.swift

-25
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.