<commit_before>//
//  RootViewController.swift
//  SimpleCustomTabBar
//
//  Created by <NAME> on 3/26/16.
//  Copyright © 2016 FDT. All rights reserved.
//

import UIKit

class RootViewController: UIViewController, UINavigationControllerDelegate {
  override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.delegate = self
  }
  
  func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
    NSNotificationCenter.defaultCenter().postNotificationName(kPageHasStartedTransition, object: viewController, userInfo: nil)
  }
}<commit_msg>Bug fix: Check if swipe back is not cancelled.<commit_after>//
//  RootViewController.swift
//  SimpleCustomTabBar
//
//  Created by <NAME> on 3/26/16.
//  Copyright © 2016 FDT. All rights reserved.
//

import UIKit

class RootViewController: UIViewController, UINavigationControllerDelegate {
  override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.delegate = self
  }
  
  func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
    // We send notification when transition is started, it's possible to cancel transition when
    // user just start swipe back and cancel it. In this case tab bar will be shown when it's not suppose to.
    // It's possible to check in transition coordinator if swipe back is not canceled.
    if let coordinator = navigationController.topViewController?.transitionCoordinator() {
      coordinator.notifyWhenInteractionEndsUsingBlock({ (context) in
        if context.isCancelled() {
          NSNotificationCenter.defaultCenter().postNotificationName(kPageHasStartedTransition, object: self, userInfo: nil)
        }
      })
    }
    NSNotificationCenter.defaultCenter().postNotificationName(kPageHasStartedTransition, object: viewController, userInfo: nil)
  }
}
{'fraction_non_alphanumeric': 0.08350202429149797, 'fraction_numerical': 0.009109311740890687, 'mean_word_length': 4.416438356164384, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2279298', 'n_tokens_mistral': 540, 'n_tokens_neox': 502, 'n_words': 149}