<commit_before>//
//  Premier+UIViewController.swift
//  PremierKit
//
//  Created by <NAME> on 24/08/2019.
//  Copyright © 2019 <NAME>. All rights reserved.
//

import UIKit

extension UIViewController {

    func add(_ child: UIViewController) {
        addChild(child)
        view.addSubview(child.view)
        child.didMove(toParent: self)
    }

    func remove() {
        guard parent != nil else {
            return
        }
        willMove(toParent: nil)
        view.removeFromSuperview()
        removeFromParent()
    }

}
<commit_msg>Improve UIViewController add/remove child methods<commit_after>//
//  Premier+UIViewController.swift
//  PremierKit
//
//  Created by <NAME> on 24/08/2019.
//  Copyright © 2019 <NAME>. All rights reserved.
//

import UIKit

extension UIViewController {

    public func add(asChildViewController viewController: UIViewController) {
        addChild(viewController)
        view.addSubview(viewController.view)
        viewController.didMove(toParent: self)
    }

    public func removeAsChildViewController() {
        guard parent != nil else {
            return
        }
        willMove(toParent: nil)
        view.removeFromSuperview()
        removeFromParent()
    }

}

{'fraction_non_alphanumeric': 0.10154346060113728, 'fraction_numerical': 0.01949634443541836, 'mean_word_length': 2.3846153846153846, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2121601', 'n_tokens_mistral': 383, 'n_tokens_neox': 350, 'n_words': 82}