Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. class ViewController: UIViewController {
  2.  
  3. private var arrayOfMethods = [String]()
  4.  
  5. @IBOutlet var greenLabel: UILabel!
  6. @IBOutlet var blueLabel: UILabel!
  7. @IBOutlet var yellowLabel: UILabel!
  8.  
  9. override func viewDidLoad() {
  10. super.viewDidLoad()
  11. printMessage()
  12. }
  13.  
  14. override func viewWillAppear(_ animated: Bool) {
  15. super.viewWillAppear(animated)
  16. printMessage()
  17. }
  18.  
  19. override func viewDidAppear(_ animated: Bool) {
  20. super.viewWillAppear(animated)
  21. printMessage()
  22. }
  23.  
  24. override func viewWillDisappear(_ animated: Bool) {
  25. super.viewWillDisappear(animated)
  26. printMessage()
  27. }
  28.  
  29. override func viewDidDisappear(_ animated: Bool) {
  30. super.viewWillDisappear(animated)
  31. printMessage()
  32. }
  33.  
  34. func printMessage(line: Int = #line, function: String = #function) {
  35. print("(title ?? "nil"). Line: (line) of function (function)")
  36. arrayOfMethods.append(function)
  37. let string = arrayOfMethods.joined(separator: "n")
  38. greenLabel.text = "(title ?? "nil") (string)"
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement