<commit_before>//
//  Transition.swift
//  Umalahokan
//
//  Created by <NAME> on 04/02/2017.
//  Copyright © 2017 Ner. All rights reserved.
//

import UIKit

protocol Transition: class {

    var duration: TimeInterval { get }
    var context: UIViewControllerContextTransitioning! { get }
    var fromViewController: UIViewController! { get }
    var toViewController: UIViewController! { get }
    
    func setup(for context: UIViewControllerContextTransitioning)
    func play(_ completion: @escaping () -> Void)
    func prelude(_ next: @escaping () -> Void)
    func epilogue(_ end: @escaping () -> Void)
}

extension Transition {
    
    func prelude(_ next: @escaping () -> Void) {
        fromViewController.beginAppearanceTransition(false, animated: true)
        toViewController.beginAppearanceTransition(true, animated: true)
        next()
    }
    
    func epilogue(_ end: @escaping () -> Void) {
        context.completeTransition(true)
        fromViewController.endAppearanceTransition()
        toViewController.endAppearanceTransition()
        end()
    }
}

struct Animation {
    
    var executor: () -> Void
    var duration: TimeInterval
    var delay: TimeInterval = 0
    var options: UIViewAnimationOptions = [.curveEaseInOut]
    
    init(duration: TimeInterval, executor: @escaping () -> Void) {
        self.duration = duration
        self.executor = executor
    }
}<commit_msg>Removed Animation struct.<commit_after>//
//  Transition.swift
//  Umalahokan
//
//  Created by <NAME> on 04/02/2017.
//  Copyright © 2017 Ner. All rights reserved.
//

import UIKit

protocol Transition: class {

    var duration: TimeInterval { get }
    var context: UIViewControllerContextTransitioning! { get }
    var fromViewController: UIViewController! { get }
    var toViewController: UIViewController! { get }
    
    func setup(for context: UIViewControllerContextTransitioning)
    func play(_ completion: @escaping () -> Void)
    func prelude(_ next: @escaping () -> Void)
    func epilogue(_ end: @escaping () -> Void)
}

extension Transition {
    
    func prelude(_ next: @escaping () -> Void) {
        fromViewController.beginAppearanceTransition(false, animated: true)
        toViewController.beginAppearanceTransition(true, animated: true)
        next()
    }
    
    func epilogue(_ end: @escaping () -> Void) {
        context.completeTransition(true)
        fromViewController.endAppearanceTransition()
        toViewController.endAppearanceTransition()
        end()
    }
}
{'fraction_non_alphanumeric': 0.10463733650416171, 'fraction_numerical': 0.009908838684106223, 'mean_word_length': 3.012718600953895, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '4660172', 'n_tokens_mistral': 764, 'n_tokens_neox': 693, 'n_words': 183}