checkpoint

This commit is contained in:
Max Hunt 2019-05-31 19:10:22 +01:00
parent ddf3ad28ae
commit 49f29a9e50
5 changed files with 79 additions and 62 deletions

View File

@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
505AFEF8229FE1BD004FF0F1 /* settingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505AFEF7229FE1BD004FF0F1 /* settingsViewController.swift */; };
505AFEFC22A154EB004FF0F1 /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505AFEFB22A154EB004FF0F1 /* TableViewCell.swift */; };
50A7ADD5229D6A4200D58743 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A7ADD4229D6A4200D58743 /* AppDelegate.swift */; };
50A7ADD7229D6A4200D58743 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A7ADD6229D6A4200D58743 /* ViewController.swift */; };
50A7ADDA229D6A4200D58743 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 50A7ADD8229D6A4200D58743 /* Main.storyboard */; };
@ -22,11 +21,11 @@
50A7AE02229D7B1100D58743 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50A7AE01229D7B1100D58743 /* MapKit.framework */; };
50A9B4E1229E115B00070F61 /* Video.mov in Resources */ = {isa = PBXBuildFile; fileRef = 50A9B4E0229E115B00070F61 /* Video.mov */; };
50C69B1122A16A7100EA99C1 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C69B1022A16A7100EA99C1 /* TableViewController.swift */; };
50C69B1322A19D8800EA99C1 /* NewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C69B1222A19D8800EA99C1 /* NewTableViewCell.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
505AFEF7229FE1BD004FF0F1 /* settingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settingsViewController.swift; sourceTree = "<group>"; };
505AFEFB22A154EB004FF0F1 /* TableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCell.swift; sourceTree = "<group>"; };
50A7ADD1229D6A4200D58743 /* Guibe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Guibe.app; sourceTree = BUILT_PRODUCTS_DIR; };
50A7ADD4229D6A4200D58743 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
50A7ADD6229D6A4200D58743 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@ -43,6 +42,7 @@
50A7AE05229D7B1E00D58743 /* Guibe.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Guibe.entitlements; sourceTree = "<group>"; };
50A9B4E0229E115B00070F61 /* Video.mov */ = {isa = PBXFileReference; lastKnownFileType = video.quicktime; path = Video.mov; sourceTree = "<group>"; };
50C69B1022A16A7100EA99C1 /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
50C69B1222A19D8800EA99C1 /* NewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTableViewCell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -83,9 +83,9 @@
50A7ADD6229D6A4200D58743 /* ViewController.swift */,
50A7ADE6229D6C7100D58743 /* Assets.xcassets */,
50A7ADD8229D6A4200D58743 /* Main.storyboard */,
505AFEFB22A154EB004FF0F1 /* TableViewCell.swift */,
50A7ADFE229D768900D58743 /* MainViewController.swift */,
50C69B1022A16A7100EA99C1 /* TableViewController.swift */,
50C69B1222A19D8800EA99C1 /* NewTableViewCell.swift */,
505AFEF7229FE1BD004FF0F1 /* settingsViewController.swift */,
50A7ADFC229D766800D58743 /* 7_ReadyViewController.swift */,
50A7ADF4229D75A900D58743 /* 3_StartViewController.swift */,
@ -195,9 +195,9 @@
50A7ADF9229D75C100D58743 /* 5_HandChoiceViewController.swift in Sources */,
50A7ADD7229D6A4200D58743 /* ViewController.swift in Sources */,
50C69B1122A16A7100EA99C1 /* TableViewController.swift in Sources */,
505AFEFC22A154EB004FF0F1 /* TableViewCell.swift in Sources */,
50A7ADF5229D75A900D58743 /* 3_StartViewController.swift in Sources */,
50A7ADD5229D6A4200D58743 /* AppDelegate.swift in Sources */,
50C69B1322A19D8800EA99C1 /* NewTableViewCell.swift in Sources */,
50A7ADFF229D768900D58743 /* MainViewController.swift in Sources */,
50A7ADFB229D75E900D58743 /* 6_SideChoiceViewController.swift in Sources */,
505AFEF8229FE1BD004FF0F1 /* settingsViewController.swift in Sources */,

View File

@ -314,7 +314,6 @@
<outlet property="searchBar" destination="dRT-vj-1ew" id="nAa-5O-h0R"/>
<outlet property="searchBarBg" destination="3Xt-Rr-hs1" id="6bL-cK-ScI"/>
<outlet property="searchView" destination="bKl-Ku-mh1" id="d0n-Pl-NrK"/>
<outlet property="tableView" destination="402-5S-nhO" id="Olu-VK-Sqm"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="a4w-SB-1GS" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -329,53 +328,64 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="70" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="402-5S-nhO">
<rect key="frame" x="0.0" y="305" width="414" height="327"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="100" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="402-5S-nhO">
<rect key="frame" x="0.0" y="305" width="414" height="591"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="cell" id="87K-Xo-0a5" customClass="TableViewCell" customModule="Guibe" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="414" height="70"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="cell" rowHeight="90" id="87K-Xo-0a5" customClass="NewTableViewCell" customModule="Guibe" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="414" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="87K-Xo-0a5" id="2HV-Qz-1Wd">
<rect key="frame" x="0.0" y="0.0" width="414" height="69.666666666666671"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="87K-Xo-0a5" id="2HV-Qz-1Wd" customClass="NewTableViewCell" customModule="Guibe" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="414" height="89.666666666666671"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dkn-bo-t7u">
<rect key="frame" x="20" y="24" width="42" height="21"/>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9iK-CB-Rc6">
<rect key="frame" x="0.0" y="0.0" width="414" height="90"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="goPressed:" destination="87K-Xo-0a5" eventType="touchUpInside" id="fxz-cj-oJk"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mlZ-q9-9a8">
<rect key="frame" x="20" y="11" width="374" height="39"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Phone number" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bBb-Ag-DTw">
<rect key="frame" x="20" y="58" width="374" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9iK-CB-Rc6">
<rect key="frame" x="0.0" y="0.0" width="414" height="70"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<action selector="goPressed:" destination="87K-Xo-0a5" eventType="touchUpInside" id="SRQ-zj-5qd"/>
</connections>
</button>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="cellLbl" destination="dkn-bo-t7u" id="7i1-bd-98c"/>
<outlet property="primaryLbl" destination="mlZ-q9-9a8" id="Rh6-Gy-EV3"/>
<outlet property="secondaryLbl" destination="bBb-Ag-DTw" id="dQc-es-DNn"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Ovf-sw-BKp" id="FAs-3b-SXl"/>
<outlet property="delegate" destination="Ovf-sw-BKp" id="Roe-ew-ZBn"/>
<outlet property="dataSource" destination="jBr-V0-GbL" id="wBX-eF-5Hf"/>
<outlet property="delegate" destination="jBr-V0-GbL" id="JWz-Zv-Onp"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="WeT-3n-RQD"/>
</view>
<connections>
<outlet property="tableView" destination="402-5S-nhO" id="Qnx-3U-4Gl"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sgH-Ai-Lho" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="883" y="1485"/>
<point key="canvasLocation" x="882.60869565217399" y="1484.5982142857142"/>
</scene>
<!--Settings View Controller-->
<scene sceneID="B3S-T4-83q">

View File

@ -252,7 +252,6 @@ extension MainViewController: CLLocationManagerDelegate {
extension MainViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
print("Here2")
searchBar.endEditing(true) //HIDES LE KEYBOARD
let localSearchRequest = MKLocalSearch.Request()
@ -266,8 +265,8 @@ extension MainViewController: UISearchBarDelegate {
resultsViewController.searchResults = response.mapItems
resultsViewController.modalTransitionStyle = .coverVertical
self.present(resultsViewController, animated: true, completion: nil)
guard let firstMapItem = response.mapItems.first else { return }
self.getDirections(to: firstMapItem)
// guard let firstMapItem = response.mapItems.first else { return }
// self.getDirections(to: firstMapItem)
}
}

View File

@ -1,5 +1,5 @@
//
// TableViewCell.swift
// NewTableViewCell.swift
// Guibe
//
// Created by Max Hunt on 31/05/2019.
@ -8,22 +8,25 @@
import UIKit
protocol tableViewProtocol {
func onClickCell(index: Int)
}
class TableViewCell: UITableViewCell {
@IBOutlet weak var cellLbl: UILabel!
class NewTableViewCell: UITableViewCell {
var cellDelegate: tableViewProtocol?
var index: IndexPath?
@IBOutlet weak var primaryLbl: UILabel!
@IBOutlet weak var secondaryLbl: UILabel!
@IBAction func goPressed(_ sender: Any) {
cellDelegate?.onClickCell(index: (index?.row)!)
}
var cellDelegate: tableViewProtocol?
var index: IndexPath?
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
@ -31,6 +34,8 @@ class TableViewCell: UITableViewCell {
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}

View File

@ -11,52 +11,55 @@ import MapKit
class TableViewController: UIViewController {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
var searchResults: [MKMapItem]?
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// let testData = appDelegate.navigationResults
}
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return searchResults?.count ?? 0
// }
//
// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
// let row = indexPath.row
//
// if let item = searchResults?[row] {
// print(item)
// cell.textLabel?.text = item.name
// }
//
// return cell
// }
} // END OF CLASS
extension TableViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.searchResults?.count ?? 0
return searchResults?.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TableViewCell
let row = indexPath.row
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! NewTableViewCell
if let item = searchResults?[row] {
cell?.cellLbl.text = item.name
// cell.phoneLabel.text = item.phoneNumber
let row = indexPath.row
if let result = searchResults?[row] {
cell.primaryLbl.text = result.name
cell.secondaryLbl.text = result.phoneNumber
cell.cellDelegate = self
cell.index = indexPath
}
// cell?.cellLbl.text = self.searchResults[indexPath.row]
// cell?.cellDelegate = self
// cell?.index = indexPath
return cell!
return cell
}
}
extension TableViewController: tableViewProtocol {
func onClickCell(index: Int) {
debugPrint("Pressed on cell number \(index)")
print("Going to navigate to option \(index)")
}
}