Verified Commit 0aef96ae authored by asahiocean's avatar asahiocean 🚀
Browse files

commit

parent 1a6e8fee
...@@ -14,17 +14,20 @@ extension ViewController: ModelDelegate { ...@@ -14,17 +14,20 @@ extension ViewController: ModelDelegate {
func modelButtonExecute(sender: UIButton) { func modelButtonExecute(sender: UIButton) {
let m = mapView.model let m = mapView.model
switch sender.tag { let tag = Model.buttonTag(rawValue: sender.tag)
case Model.buttonTag.graphs.rawValue: switch tag {
case .graphs:
print("Trying to build graphs...") print("Trying to build graphs...")
constructGraphs() constructGraphs()
case Model.buttonTag.start.rawValue: case .start:
guard m.selected != nil else { return } if m.selected != nil {
print("User has chosen a starting point!") print("User has chosen a starting point!")
case Model.buttonTag.finish.rawValue: } else { /* ... */ }
guard m.selected != nil else { return } case .finish:
print("User selected endpoint!") if m.selected != nil {
case Model.buttonTag.routecalc.rawValue: print("User selected endpoint!")
} else { /* ... */ }
case .routecalc:
print("Trying to make the shortest route!") print("Trying to make the shortest route!")
let coords = m.route.compactMap({ $0.coordinate }) let coords = m.route.compactMap({ $0.coordinate })
...@@ -34,7 +37,7 @@ extension ViewController: ModelDelegate { ...@@ -34,7 +37,7 @@ extension ViewController: ModelDelegate {
} }
} }
mainButton?.removeTarget(nil, action: nil, for: .allEvents) mainButton?.removeTarget(nil, action: nil, for: .allEvents)
case Model.buttonTag.clear.rawValue: case .clear:
clearingMap() clearingMap()
print("❌ Clearing the map...") print("❌ Clearing the map...")
default: fatalError() default: fatalError()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment