<commit_before>//
//  DraftTransitioningDelegate.swift
//  StackedDrafts
//
//  Created by <NAME> on 4/21/16.
//  Copyright © 2016 Stack Exchange. All rights reserved.
//

import UIKit


/**
 This class manages animation, presentation, and interactive dismissal of view controllers conforming to `DraftViewControllerProtocol`.  Before being presented, draft view controllers should set their `transitioningDelegate` to an instance of this class and `modalPresentationStyle` to `.Custom`.
 
 - Note: When the presentation animation is completed, the presenting view controller is replaced with a view that simulates its color and navigation bar appearance. Subclasses may override `simulatedPresentingView(for:)` to handle complex view controller styles.
 */
@objc(SEUIDraftTransitioningDelegate) open class DraftTransitioningDelegate : NSObject, UIViewControllerTransitioningDelegate {
    
    open func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
        guard let presenting = presenting else { return nil }
        return DraftPresentationController(presentedViewController: presented, presenting: presenting)
    }
    
    open func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return SingleDraftPresentationAnimatedTransitioning()
    }
    
    open func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return DraftDismissalAnimatedTransitioning(interactiveTransitioning: dismissed.draftPresentationController?.interactiveTransitioning)
    }
    
    open func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        return (animator as? DraftDismissalAnimatedTransitioning)?.interactiveTransitioning
    }
    
    /**
     This method is called by the presentation controller when the animation completes in order to show what appears to be the top of the presenting view controller behind the presented view controller.  The view controller is obscured in such a way that no more than the top 20pt should be visible in when the status bar is visible and 5pt when the status bar is hidden.  This should cause most or all navigation bar content hidden so a solid background would be sufficient.
     
     The default implementation of this method renders either a solid background for a presenting UIViewController or a matching navigation bar for a presenting UINavigationController.  This method can be overwritten in a subclass to handle more complex requirements.
     
     - Parameter presentingViewController: The view controller that should be simulated.
     
     - Returns: The UIView to display.
     <commit_msg>I'm blaming this on the migration.<commit_after>//
//  DraftTransitioningDelegate.swift
//  StackedDrafts
//
//  Created by <NAME> on 4/21/16.
//  Copyright © 2016 Stack Exchange. All rights reserved.
//

import UIKit


/**
 This class manages animation, presentation, and interactive dismissal of view controllers conforming to `DraftViewControllerProtocol`.  Before being presented, draft view controllers should set their `transitioningDelegate` to an instance of this class and `modalPresentationStyle` to `.Custom`.
 
 - Note: When the presentation animation is completed, the presenting view controller is replaced with a view that simulates its color and navigation bar appearance. Subclasses may override `simulatedPresentingView(for:)` to handle complex view controller styles.
 */
@objc(SEUIDraftTransitioningDelegate) open class DraftTransitioningDelegate : NSObject, UIViewControllerTransitioningDelegate {
    
    open func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
        return DraftPresentationController(presentedViewController: presented, presenting: presenting)
    }
    
    open func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return SingleDraftPresentationAnimatedTransitioning()
    }
    
    open func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return DraftDismissalAnimatedTransitioning(interactiveTransitioning: dismissed.draftPresentationController?.interactiveTransitioning)
    }
    
    open func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
        return (animator as? DraftDismissalAnimatedTransitioning)?.interactiveTransitioning
    }
    
    /**
     This method is called by the presentation controller when the animation completes in order to show what appears to be the top of the presenting view controller behind the presented view controller.  The view controller is obscured in such a way that no more than the top 20pt should be visible in when the status bar is visible and 5pt when the status bar is hidden.  This should cause most or all navigation bar content hidden so a solid background would be sufficient.
     
     The default implementation of this method renders either a solid background for a presenting UIViewController or a matching navigation bar for a presenting UINavigationController.  This method can be overwritten in a subclass to handle more complex requirements.
     
     - Parameter presentingViewController: The view controller that should be simulated.
     
     - Returns: The UIView to display.
     
{'fraction_non_alphanumeric': 0.04701222662304116, 'fraction_numerical': 0.004132942999827794, 'mean_word_length': 4.722167487684729, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4738382', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1236, 'n_words': 556}