-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeleteViewController.swift
68 lines (50 loc) · 1.82 KB
/
DeleteViewController.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// DeleteViewController.swift
// tvBMC
//
// Created by Renata Faria on 03/03/17.
// Copyright © 2017 BepidCanvas. All rights reserved.
//
import UIKit
class DeleteViewController: UIViewController {
private var postitFocused : PostitCell?
@IBOutlet weak var lblTitle: UILabel! //bmc or postit
@IBOutlet weak var lblDescription: UITextView!
@IBAction func btnConfirmDelete(_ sender: UIButton) {
//if delete button was clicked
postitFocused?.postit.destroy({
sucess in
if sucess{
print("postit deleted")
}
else{
print("postit not deleted")
}
self.dismiss(animated: true, completion: nil)
})
}
@IBAction func btnCancelDelete(_ sender: UIButton) {
//just dismiss the screen if cancel was clicked
self.dismiss(animated: true, completion: nil)
}
override func unwind(for unwindSegue: UIStoryboardSegue, towardsViewController subsequentVC: UIViewController) {
print("dismiss")
}
func getSelected(postitFocused : PostitCell){
self.postitFocused = postitFocused
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("postit selected: \(postitFocused)")
//compare if is postit or bmc and change title and description (TODO)
self.lblTitle.text = "Delete post-it"
self.lblDescription.text = "If you delete it, all data will be deleted too. Are you sure you want to delete this Post-it?"
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}