-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathComposeViewController.swift
50 lines (37 loc) · 1.25 KB
/
ComposeViewController.swift
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// ComposeViewController.swift
// ToDoList
//
// Created by Davis Gossage on 2/1/16.
// Copyright © 2016 Davis Gossage. All rights reserved.
//
import UIKit
protocol ComposeDelegate {
func userSavedItem(item: ToDoItem)
}
class ComposeViewController: UIViewController {
var delegate: ComposeDelegate?
@IBOutlet var textField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func saveButtonTapped() {
let newItem = ToDoItem()
newItem.itemDescription = textField.text
delegate?.userSavedItem(newItem)
self.navigationController?.popViewControllerAnimated(true)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}