-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
222 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Checklists.xcodeproj/xcuserdata/mriddle.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Bucket | ||
type = "1" | ||
version = "2.0"> | ||
<Breakpoints> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
filePath = "Checklists/ChecklistItem.swift" | ||
timestampString = "483431778.647364" | ||
startingColumnNumber = "9223372036854775807" | ||
endingColumnNumber = "9223372036854775807" | ||
startingLineNumber = "16" | ||
endingLineNumber = "16" | ||
landmarkName = "init(text:checked:)" | ||
landmarkType = "5"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
filePath = "Checklists/ChecklistViewController.swift" | ||
timestampString = "483431293.296945" | ||
startingColumnNumber = "9223372036854775807" | ||
endingColumnNumber = "9223372036854775807" | ||
startingLineNumber = "40" | ||
endingLineNumber = "40" | ||
landmarkName = "tableView(_:cellForRowAtIndexPath:)" | ||
landmarkType = "5"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
</Breakpoints> | ||
</Bucket> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<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="BYZ-38-t0r"> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="0EI-kG-L1l"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> | ||
</dependencies> | ||
<scenes> | ||
<!--View Controller--> | ||
<scene sceneID="tne-QT-ifu"> | ||
<!--Checklist View Controller--> | ||
<scene sceneID="VS5-Ai-0gM"> | ||
<objects> | ||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"> | ||
<layoutGuides> | ||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> | ||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> | ||
</layoutGuides> | ||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | ||
<tableViewController id="0EI-kG-L1l" customClass="ChecklistViewController" customModule="Checklists" customModuleProvider="target" sceneMemberID="viewController"> | ||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="l5t-lE-Kti"> | ||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
<prototypes> | ||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="checkmark" indentationWidth="10" reuseIdentifier="ChecklistItem" id="pcY-ab-PJf"> | ||
<rect key="frame" x="0.0" y="28" width="600" height="44"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pcY-ab-PJf" id="Yyu-oC-sqR"> | ||
<rect key="frame" x="0.0" y="0.0" width="561" height="43.5"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<label opaque="NO" userInteractionEnabled="NO" tag="1000" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7UG-qx-RTx"> | ||
<rect key="frame" x="8" y="11" width="553" height="21"/> | ||
<fontDescription key="fontDescription" type="system" pointSize="17"/> | ||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> | ||
<nil key="highlightedColor"/> | ||
</label> | ||
</subviews> | ||
</tableViewCellContentView> | ||
</tableViewCell> | ||
</prototypes> | ||
<connections> | ||
<outlet property="dataSource" destination="0EI-kG-L1l" id="tKA-1S-Rzv"/> | ||
<outlet property="delegate" destination="0EI-kG-L1l" id="Ogo-Fc-Jim"/> | ||
</connections> | ||
</tableView> | ||
</tableViewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="mBe-6g-oHr" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="169" y="603"/> | ||
</scene> | ||
</scenes> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// ChecklistItem.swift | ||
// Checklists | ||
// | ||
// Created by Matthew Riddle on 27/04/2016. | ||
// Copyright © 2016 Matthew Riddle. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
class ChecklistItem { | ||
var text: String | ||
var checked: Bool | ||
|
||
init(text: String, checked: Bool) { | ||
self.text = text | ||
self.checked = checked | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// ViewController.swift | ||
// Checklists | ||
// | ||
// Created by Matthew Riddle on 27/04/2016. | ||
// Copyright © 2016 Matthew Riddle. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ChecklistViewController: UITableViewController { | ||
var items: Array = [ | ||
ChecklistItem(text: "Walk the dog", checked: false), | ||
ChecklistItem(text: "Brush teeth", checked: false), | ||
ChecklistItem(text: "Learn iOS development", checked: false), | ||
ChecklistItem(text: "Soccer practice", checked: false), | ||
ChecklistItem(text: "Eat ice cream", checked: false) | ||
] | ||
|
||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
// Do any additional setup after loading the view, typically from a nib. | ||
} | ||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
return 5 | ||
} | ||
|
||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | ||
let cell = tableView.dequeueReusableCellWithIdentifier("ChecklistItem", forIndexPath: indexPath) | ||
|
||
let label = cell.viewWithTag(1000) as! UILabel | ||
|
||
if indexPath.row < items.count { | ||
label.text = items[indexPath.row].text | ||
} | ||
configureCheckmarkForCell(cell, atIndexPath: indexPath) | ||
return cell | ||
} | ||
|
||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { | ||
|
||
if let cell = tableView.cellForRowAtIndexPath(indexPath) { | ||
if indexPath.row < items.count { | ||
let item = items[indexPath.row] | ||
item.checked = !item.checked | ||
} | ||
|
||
configureCheckmarkForCell(cell, atIndexPath: indexPath) | ||
} | ||
|
||
tableView.deselectRowAtIndexPath(indexPath, animated: true) | ||
} | ||
|
||
func configureCheckmarkForCell(cell: UITableViewCell, atIndexPath: NSIndexPath) { | ||
if atIndexPath.row < items.count { | ||
let item = items[atIndexPath.row] | ||
|
||
if item.checked { | ||
cell.accessoryType = .Checkmark | ||
} else { | ||
cell.accessoryType = .None | ||
} | ||
} | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.