<commit_before>//
//  WireframeInterface.swift
//  Presence-iOS
//
//  Created by Iki on 05/02/16.
//  Copyright © 2016 Infinum. All rights reserved.
//

import Foundation
import UIKit

// MARK: - Base Wireframe Interface -
protocol WireframeInterface {
    
    // MARK: REQUIRED
    var storyboard:UIStoryboard { get }
    weak var navigationController: UINavigationController? { get set }
    weak var viewController: UIViewController? { get set }

    init()

    func instantiateViewController<T>(context: T) -> UIViewController

}

// MARK: - Base Wireframe Interface Default Implementation -
extension WireframeInterface {

    // MARK: CONVENIENCE INIT
    init(navigationController: UINavigationController? = nil) {
        self.init()
        self.navigationController = navigationController
    }

    // MARK: PUSH
    func pushViewController() {
        navigationController?.pushViewController(instantiateViewController(), animated: true)
    }

    func pushViewController<T>(context: T) {
        navigationController?.pushViewController(instantiateViewController(T), animated: true)
    }

    // MARK: POP
    func popViewController() {
        navigationController?.popViewControllerAnimated(true)
    }
    
    // MARK: PRESENT
    func presentFromViewController(viewController: UIViewController) {
        viewController.presentViewController(instantiateViewController(), animated: true, completion: nil)
    }

    func presentFromViewController<T>(viewController: UIViewController, context: T) {
        viewController.presentViewController(instantiateViewController(T), animated: true, completion: nil)
    }

    // MARK: DISMISS
    func dismissViewController() {
        viewController?.dismissViewControllerAnimated(true, completion: nil)
    }
}<commit_msg>Remove optional param from generic method to allow calling without arguments.<commit_after>//
//  WireframeInterface.swift
//  Presence-iOS
//
//  Created by Iki on 05/02/16.
//  Copyright © 2016 Infinum. All rights reserved.
//

import Foundation
import UIKit

// MARK: - Base Wireframe Interface -
protocol WireframeInterface {
    
    // MARK: REQUIRED
    var storyboard:UIStoryboard { get }
    weak var navigationController: UINavigationController? { get set }
    weak var viewController: UIViewController? { get set }

    init()

    func instantiateViewController<T>(context: T) -> UIViewController

}

// MARK: - Base Wireframe Interface Default Implementation -
extension WireframeInterface {

    // MARK: CONVENIENCE INIT
    init(navigationController: UINavigationController? = nil) {
        self.init()
        self.navigationController = navigationController
    }

    // MARK: PUSH
    func pushViewController<T>(context: T) {
        navigationController?.pushViewController(instantiateViewController(context), animated: true)
    }

    // MARK: POP
    func popViewController() {
        navigationController?.popViewControllerAnimated(true)
    }
    
    // MARK: PRESENT
    func presentFromViewController<T>(viewController: UIViewController, context: T) {
        viewController.presentViewController(instantiateViewController(context), animated: true, completion: nil)
    }

    // MARK: DISMISS
    func dismissViewController() {
        viewController?.dismissViewControllerAnimated(true, completion: nil)
    }
}
{'fraction_non_alphanumeric': 0.09213685474189676, 'fraction_numerical': 0.006002400960384154, 'mean_word_length': 3.473825503355705, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4334681', 'n_tokens_mistral': 947, 'n_tokens_neox': 832, 'n_words': 215}