2 //  WLViewController.swift
 
   5 //  Created by Pawel Dabrowski on 25/09/2018.
 
   6 //  Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
 
  12 class WLViewController: UIViewController {
 
  14     func name() -> String {
 
  16         return String(describing: type(of: self)).replacingOccurrences(of: "ViewController", with: "")
 
  19     func parentNames() -> [String] {
 
  20         var namesList = [String]()
 
  21         if let controller = self.parent as? WLViewController {
 
  22             namesList.append(contentsOf: controller.parentNames())
 
  23             namesList.append(name())
 
  25         else if let controller = self.parent as? UINavigationController {
 
  26             for vc in controller.childViewControllers{
 
  27                 if let vc = vc as? WLViewController {
 
  28                     namesList.append(vc.name())
 
  33             namesList.append(name())
 
  40         print("trackScreen \(parentNames())")
 
  41         MatomoTracker.shared.track(view: parentNames())
 
  44     override func viewDidLoad() {
 
  49     override func didReceiveMemoryWarning() {
 
  50         super.didReceiveMemoryWarning()
 
  51         // Dispose of any resources that can be recreated.