<commit_before>//
//  DetailViewController.swift
//  StormViewer
//
//  Created by <NAME> on 10/11/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit

class DetailViewController: UIViewController {

  @IBOutlet weak var scrollView: UIScrollView!
  var detailImageView: UIImageView!
  
  var detailItem: String? {
    didSet {
      // Update the view.
      self.configureView()
    }
  }
  
  func configureView() {
    // Update the user interface for the detail item.
    if let detail = self.detailItem {
      if let imageView = self.detailImageView {
        imageView.image = UIImage(named: detail)
      }
    }
  }
  
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    self.detailImageView = UIImageView(image: UIImage(named:"nssl0049.jpg"))
    self.detailImageView.frame = self.scrollView.bounds
    self.detailImageView.contentMode = .ScaleAspectFill
    self.scrollView.contentMode = .ScaleAspectFit
    
    self.scrollView.delegate = self
    
    let scale = self.detailImageView.frame.size.width / self.scrollView.frame.size.width
    self.scrollView.maximumZoomScale = scale;
    self.scrollView.minimumZoomScale = 0.25;
    //let scale = self.scrollView.frame.size.width  / self.detailImageView.frame.size.width
    //self.scrollView.zoomScale = scale;
    //self.scrollView.zoomScale = 1
    
    //self.scrollView.clipsToBounds = true
    //self.detailImageView.sizeToFit()
    
    self.scrollView.addSubview(self.detailImageView)
    self.scrollView.contentSize = self.detailImageView.frame.size;

    self.configureView()
  }
  
  override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    navigationController?.hidesBarsOnTap = true
  }
  
  override func viewWillDisappear(animated: Bool) {
    super.viewWillDisappear(animated)
    navigationController?.hidesBarsOnTap = false
  }
  
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.<commit_msg>ok, I seriously tried<commit_after>//
//  DetailViewController.swift
//  StormViewer
//
//  Created by <NAME> on 10/11/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit

class DetailViewController: UIViewController {

  @IBOutlet weak var scrollView: UIScrollView!
  var detailImageView: UIImageView!
  
  var detailItem: String? {
    didSet {
      // Update the view.
      self.configureView()
    }
  }
  
  func configureView() {
    // Update the user interface for the detail item.
    if let detail = self.detailItem {
      if let imageView = self.detailImageView {
        imageView.image = UIImage(named: detail)
        imageView.frame = self.scrollView.bounds
        self.scrollView.contentSize = imageView.bounds.size
        self.scrollView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
        self.scrollView.delegate = self
        
        let imageViewSize = imageView.bounds.size
        let scrollViewSize = scrollView.bounds.size
        let widthScale = scrollViewSize.width / imageViewSize.width
        let heightScale = scrollViewSize.height / imageViewSize.height
        
        let zoomScale = min(widthScale, heightScale)
        self.scrollView.maximumZoomScale = 4.0
        self.scrollView.minimumZoomScale = 0.5
        self.scrollView.zoomScale = zoomScale
        
        self.scrollView.contentMode = .ScaleAspectFill
        //self.scrollView.frame = imageView.bounds
      }
    }
  }
  
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    self.detailImageView = UIImageView(frame: self.scrollView.bounds)
    self.scrollView.addSubview(self.detailImageView)

    self.configureView()
  }
  
  override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    navigationController?.hidesBarsOnTap = true
  }
  
  override func viewWillDisappear(animated: Bool) {
    super.viewWillDisappear(animated)
    navigationController?.hidesBarsOnTap = false
  }
  
  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
{'fraction_non_alphanumeric': 0.09112259276655707, 'fraction_numerical': 0.007515265382808831, 'mean_word_length': 2.95817843866171, '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': '2541448', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1256, 'n_words': 276}