<commit_before>//
//  FormViewController.swift
//  Pods
//
//  Created by <NAME> on 16/01/2016.
//
//

import UIKit

public class FormViewController: UITableViewController {
    
    // MARK: - Properties
    
    public lazy private(set) var form: Form = {
        return self.configuredForm()
    }()
    
    private var hasAutomaticallyBecomeFirstResponder = false

    // MARK: - Public Methods
    
    public func configuredForm() -> Form {
        return Form()
    }
    
    public func configureVisibleFormRows() {
        guard let indexPaths = tableView.indexPathsForVisibleRows else { return }

        for indexPath in indexPaths {
            let row = form.rowForIndexPath(indexPath)
            guard let cell = tableView.cellForRowAtIndexPath(indexPath) else { fatalError("Expected cell to be returned for index path \(indexPaths)") }
            row.configureTableViewCell(cell)
        }
    }

    // MARK: - UIViewController

    public override func viewDidLoad() {
        super.viewDidLoad()

        form.registerTableViewCellsForTableView(tableView)
    }
    
    public override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

        automaticallyBecomeFirstResponder()
    }
    
    public override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(animated)
        view.endEditing(true)
    }
    <commit_msg>Added support for dynamic cell heights.<commit_after>//
//  FormViewController.swift
//  Pods
//
//  Created by <NAME> on 16/01/2016.
//
//

import UIKit

public class FormViewController: UITableViewController {
    
    // MARK: - Properties
    
    public lazy private(set) var form: Form = {
        return self.configuredForm()
    }()
    
    private var hasAutomaticallyBecomeFirstResponder = false

    // MARK: - Public Methods
    
    public func configuredForm() -> Form {
        return Form()
    }
    
    public func configureVisibleFormRows() {
        guard let indexPaths = tableView.indexPathsForVisibleRows else { return }

        for indexPath in indexPaths {
            let row = form.rowForIndexPath(indexPath)
            guard let cell = tableView.cellForRowAtIndexPath(indexPath) else { fatalError("Expected cell to be returned for index path \(indexPaths)") }
            row.configureTableViewCell(cell)
        }
    }

    // MARK: - UIViewController

    public override func viewDidLoad() {
        super.viewDidLoad()

        tableView.estimatedRowHeight = 44.0
        form.registerTableViewCellsForTableView(tableView)
    }
    
    public override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

        automaticallyBecomeFirstResponder()
    }
    
    public override func viewWillDisappear(animated: Bool) {
        super.viewWillDisappear(animated)
        view.endEditing(true)
    }
    
{'fraction_non_alphanumeric': 0.08391608391608392, 'fraction_numerical': 0.006643356643356644, 'mean_word_length': 2.4553140096618358, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3099104', 'n_tokens_mistral': 846, 'n_tokens_neox': 788, 'n_words': 187}