 
 import UIKit
 
+
+/// the kind of window modes that are supported by TinyConsole
+///
+/// - collapsed: the console is hidden
+/// - expanded: the console is shown
 enum TinyConsoleWindowMode {
     case collapsed
     case expanded
 }
 
 open class TinyConsoleController: UIViewController {
+    
+    // MARK: - Public Properties -
     var rootViewController: UIViewController?
     
     var consoleViewController: TinyConsoleViewController = {

        setupConstraints()
    }
    
    lazy var consoleViewHeightConstraint: NSLayoutConstraint? = {
        if #available(iOS 9, *) {
            return self.consoleViewController.view.heightAnchor.constraint(equalToConstant: 0)
        } else {
            return NSLayoutConstraint(item: self.consoleViewController.view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 0)
        }
    }()
    
    func setupConstraints() {
        if #available(iOS 9, *) {
            let rootViewControllerView = rootViewController?.view
            rootViewControllerView?.translatesAutoresizingMaskIntoConstraints = false
            rootViewControllerView?.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
            rootViewControllerView?.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
            rootViewControllerView?.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
            
            consoleViewController.view.translatesAutoresizingMaskIntoConstraints = false
            consoleViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
            consoleViewController.view.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
            consoleViewController.view.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
            
            consoleViewHeightConstraint?.isActive = true
            
            rootViewController?.view.bottomAnchor.constraint(equalTo: consoleViewController.view.topAnchor).isActive = true
        } else {
            rootViewController?.view.translatesAutoresizingMaskIntoConstraints = false
            NSLayoutConstraint(item: (rootViewController?.view)!, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1.0, constant: 0).isActive = true
            NSLayoutConstraint(item: (rootViewController?.view)!, attribute: .left, relatedBy: .equal, toItem: view, attribute: .left, multiplier: 1.0, constant: 0).isActive = true
            NSLayoutConstraint(item: (rootViewController?.view)!, attribute: .right, relatedBy: .equal, toItem: view, attribute: .right, multiplier: 1.0, constant: 0).isActive = true
            
            consoleViewController.view.translatesAutoresizingMaskIntoConstraints = false
            NSLayoutConstraint(item: consoleViewController.view, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1.0, constant: 0).isActive = true
            NSLayoutConstraint(item: self.consoleViewController.view, attribute: .left, relatedBy: .equal, toItem: view, attribute: .left, multiplier: 1.0, constant: 0).isActive = true
            NSLayoutConstraint(item: self.consoleViewController.view, attribute: .right, relatedBy: .equal, toItem: view, attribute: .right, multiplier: 1.0, constant: 0).isActive = true
            
            consoleViewHeightConstraint?.isActive = true
            
            NSLayoutConstraint(item: (rootViewController?.view)!, attribute: .bottom, relatedBy: .equal, toItem: consoleViewController.view, attribute: .top, multiplier: 1.0, constant: 0).isActive = true
        }

        super.init(coder: aDecoder)
    }
    
    // MARK: - Public Methods -
    override open func viewDidLoad() {
        super.viewDidLoad()
        
        addChildViewController(consoleViewController)
        consoleViewController.view.frame = consoleFrame
