<commit_before>//
//  PhotoViewController.swift
//  Spendy
//
//  Created by <NAME> on 9/24/15.
//  Copyright © 2015 Cheetah. All rights reserved.
//

import UIKit
import VIPhotoView
import PhotoTweaks

@objc protocol PhotoViewControllerDelegate {
    optional func photoViewController(photoViewController: PhotoViewController, didUpdateImage image: UIImage)
}

class PhotoViewController: UIViewController {
    
    @IBOutlet weak var changeButton: UIButton!
    
    @IBOutlet weak var editButton: UIButton!
    
    var selectedImage: UIImage?

    var cancelButton: UIButton?
    var saveButton: UIButton?
    
    var photoView: VIPhotoView!
    var imagePicker: UIImagePickerController!
    
    weak var delegate: PhotoViewControllerDelegate?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        addBarButton()
        
        tabBarController!.tabBar.hidden = true
        
        imagePicker = UIImagePickerController()
        imagePicker.delegate = self
        
        if selectedImage != nil {
            setPhoto()
        }
        
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(true)<commit_msg>Fix bug: crash when transferring to Photo view<commit_after>//
//  PhotoViewController.swift
//  Spendy
//
//  Created by <NAME> on 9/24/15.
//  Copyright © 2015 Cheetah. All rights reserved.
//

import UIKit
import VIPhotoView
import PhotoTweaks

@objc protocol PhotoViewControllerDelegate {
    optional func photoViewController(photoViewController: PhotoViewController, didUpdateImage image: UIImage)
}

class PhotoViewController: UIViewController {
    
    @IBOutlet weak var changeButton: UIButton!
    
    @IBOutlet weak var editButton: UIButton!
    
    var selectedImage: UIImage?

    var cancelButton: UIButton?
    var saveButton: UIButton?
    
    var photoView: VIPhotoView!
    var imagePicker: UIImagePickerController!
    
    weak var delegate: PhotoViewControllerDelegate?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        addBarButton()
        
        if tabBarController != nil {
            tabBarController!.tabBar.hidden = true
        }
        
        imagePicker = UIImagePickerController()
        imagePicker.delegate = self
        
        if selectedImage != nil {
            setPhoto()
        }
        
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(true)
{'fraction_non_alphanumeric': 0.07096512570965126, 'fraction_numerical': 0.0072992700729927005, 'mean_word_length': 2.4844632768361583, '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': '645845', 'n_tokens_mistral': 710, 'n_tokens_neox': 661, 'n_words': 175}