FIX THIS
This commit is contained in:
parent
50f78df781
commit
ddf3ad28ae
@ -21,6 +21,7 @@
|
||||
50A7ADFF229D768900D58743 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A7ADFE229D768900D58743 /* MainViewController.swift */; };
|
||||
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 */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -41,6 +42,7 @@
|
||||
50A7AE01229D7B1100D58743 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
|
||||
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>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -83,6 +85,7 @@
|
||||
50A7ADD8229D6A4200D58743 /* Main.storyboard */,
|
||||
505AFEFB22A154EB004FF0F1 /* TableViewCell.swift */,
|
||||
50A7ADFE229D768900D58743 /* MainViewController.swift */,
|
||||
50C69B1022A16A7100EA99C1 /* TableViewController.swift */,
|
||||
505AFEF7229FE1BD004FF0F1 /* settingsViewController.swift */,
|
||||
50A7ADFC229D766800D58743 /* 7_ReadyViewController.swift */,
|
||||
50A7ADF4229D75A900D58743 /* 3_StartViewController.swift */,
|
||||
@ -191,6 +194,7 @@
|
||||
50A7ADFD229D766800D58743 /* 7_ReadyViewController.swift in Sources */,
|
||||
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 */,
|
||||
|
||||
@ -7,12 +7,15 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MapKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
var navigationResults: MKDirections.Response?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
|
||||
@ -300,8 +300,37 @@
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<viewLayoutGuide key="safeArea" id="Ut7-03-t0b"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="dismissBtn" destination="efK-Gw-gxB" id="upX-k6-K16"/>
|
||||
<outlet property="mapView" destination="Bex-Mk-DDO" id="2Ww-7N-bZc"/>
|
||||
<outlet property="menuBtn" destination="m8G-AJ-moq" id="QXG-rH-6Lm"/>
|
||||
<outlet property="menuView" destination="VZj-Lm-Ems" id="IBs-mV-GJW"/>
|
||||
<outlet property="menuWindowView" destination="J48-J9-3Mc" id="gnS-K2-H8d"/>
|
||||
<outlet property="micBtn" destination="G7y-oE-2AD" id="W6R-nB-sax"/>
|
||||
<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"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="882.60869565217399" y="776.78571428571422"/>
|
||||
</scene>
|
||||
<!--Table View Controller-->
|
||||
<scene sceneID="UD8-kt-3HT">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="resultsScreen" useStoryboardIdentifierAsRestorationIdentifier="YES" id="jBr-V0-GbL" customClass="TableViewController" customModule="Guibe" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Rps-Dk-rvQ">
|
||||
<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="569" width="414" height="327"/>
|
||||
<rect key="frame" x="0.0" y="305" width="414" height="327"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<prototypes>
|
||||
@ -341,24 +370,12 @@
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<viewLayoutGuide key="safeArea" id="Ut7-03-t0b"/>
|
||||
<viewLayoutGuide key="safeArea" id="WeT-3n-RQD"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="dismissBtn" destination="efK-Gw-gxB" id="upX-k6-K16"/>
|
||||
<outlet property="mapView" destination="Bex-Mk-DDO" id="2Ww-7N-bZc"/>
|
||||
<outlet property="menuBtn" destination="m8G-AJ-moq" id="QXG-rH-6Lm"/>
|
||||
<outlet property="menuView" destination="VZj-Lm-Ems" id="IBs-mV-GJW"/>
|
||||
<outlet property="menuWindowView" destination="J48-J9-3Mc" id="gnS-K2-H8d"/>
|
||||
<outlet property="micBtn" destination="G7y-oE-2AD" id="W6R-nB-sax"/>
|
||||
<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"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="sgH-Ai-Lho" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="882.60869565217399" y="776.78571428571422"/>
|
||||
<point key="canvasLocation" x="883" y="1485"/>
|
||||
</scene>
|
||||
<!--Settings View Controller-->
|
||||
<scene sceneID="B3S-T4-83q">
|
||||
|
||||
@ -14,13 +14,13 @@ import AVFoundation
|
||||
|
||||
class MainViewController: UIViewController, AVAudioPlayerDelegate {
|
||||
|
||||
|
||||
var testData = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25"]
|
||||
|
||||
// DELETE
|
||||
let defaults = UserDefaults.standard
|
||||
// DELETE
|
||||
|
||||
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
||||
|
||||
|
||||
let locationManager = CLLocationManager()
|
||||
var currentCoordinate: CLLocationCoordinate2D!
|
||||
|
||||
@ -105,6 +105,16 @@ class MainViewController: UIViewController, AVAudioPlayerDelegate {
|
||||
let directions = MKDirections(request: directionsRequest)
|
||||
directions.calculate { (response, _) in
|
||||
guard let response = response else { return }
|
||||
|
||||
// self.appDelegate.navigationResults = response
|
||||
|
||||
|
||||
|
||||
// let resultsViewController = self.storyboard?.instantiateViewController(withIdentifier: "resultsScreen") as! TableViewController
|
||||
// resultsViewController.searchResults = response
|
||||
// resultsViewController.modalTransitionStyle = .coverVertical
|
||||
// self.present(resultsViewController, animated: true, completion: nil)
|
||||
|
||||
guard let primaryRoute = response.routes.first else { return }
|
||||
|
||||
self.mapView.addOverlay(primaryRoute.polyline)
|
||||
@ -252,6 +262,10 @@ extension MainViewController: UISearchBarDelegate {
|
||||
let localSearch = MKLocalSearch(request: localSearchRequest)
|
||||
localSearch.start { (response, _) in
|
||||
guard let response = response else { return }
|
||||
let resultsViewController = self.storyboard?.instantiateViewController(withIdentifier: "resultsScreen") as! TableViewController
|
||||
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)
|
||||
}
|
||||
@ -279,24 +293,3 @@ extension MainViewController: MKMapViewDelegate {
|
||||
return MKOverlayRenderer()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension MainViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return testData.count
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TableViewCell
|
||||
cell?.cellLbl.text = testData[indexPath.row]
|
||||
cell?.cellDelegate = self
|
||||
cell?.index = indexPath
|
||||
return cell!
|
||||
}
|
||||
}
|
||||
|
||||
extension MainViewController: tableViewProtocol {
|
||||
func onClickCell(index: Int) {
|
||||
debugPrint("Pressed on cell number \(index)")
|
||||
}
|
||||
}
|
||||
|
||||
62
Guibe/TableViewController.swift
Normal file
62
Guibe/TableViewController.swift
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// TableViewController.swift
|
||||
// Guibe
|
||||
//
|
||||
// Created by Max Hunt on 31/05/2019.
|
||||
// Copyright © 2019 8. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MapKit
|
||||
|
||||
class TableViewController: UIViewController {
|
||||
|
||||
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
||||
|
||||
var searchResults: [MKMapItem]?
|
||||
|
||||
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.
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
extension TableViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return self.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
|
||||
|
||||
if let item = searchResults?[row] {
|
||||
cell?.cellLbl.text = item.name
|
||||
// cell.phoneLabel.text = item.phoneNumber
|
||||
}
|
||||
// cell?.cellLbl.text = self.searchResults[indexPath.row]
|
||||
// cell?.cellDelegate = self
|
||||
// cell?.index = indexPath
|
||||
return cell!
|
||||
}
|
||||
}
|
||||
|
||||
extension TableViewController: tableViewProtocol {
|
||||
func onClickCell(index: Int) {
|
||||
debugPrint("Pressed on cell number \(index)")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user