Created
January 28, 2017 01:00
-
-
Save marianomike/a23c824b7aabf545da5cfbfd7564d250 to your computer and use it in GitHub Desktop.
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
import UIKit | |
import MapKit | |
import CoreLocation | |
class ViewController: UIViewController, UITextFieldDelegate, CLLocationManagerDelegate, MKMapViewDelegate { | |
// reference the user input field | |
@IBOutlet weak var inputText: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
inputText.delegate = self | |
} | |
func textFieldShouldReturn(_ textField: UITextField) -> Bool { | |
// Hide the keyboard. | |
textField.resignFirstResponder() | |
return true | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
@IBAction func unwindToMenu(segue: UIStoryboardSegue) {} | |
// pass the value of the input throught the segue | |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
if segue.identifier == "showSecondViewController" { | |
let secondViewController = segue.destination as? SecondViewController | |
secondViewController?.userText = inputText.text | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment