<commit_before>//
//  FirstViewController.swift
//  KeynodeExample
//
//  Created by <NAME> on 2014/12/14.
//  Copyright (c) 2014年 kyohei_ito. All rights reserved.
//

import UIKit
import Keynode

class FirstViewController: UIViewController {
    let tableSourceList: [[String]] = [[Int](1...20).map{ "cell \($0)" }]
    
    @IBOutlet weak var toolbar: UIView!
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var toolbarBottomSpaceConstraint: NSLayoutConstraint!
    lazy var keynode: Keynode.Connector = Keynode.Connector(view: self.tableView)

    override func viewDidLoad() {
        super.viewDidLoad()
        
        keynode.defaultInsetBottom = toolbar.bounds.height
        keynode.willAnimationHandler = { [weak self] show, rect in
            if let me = self {
                me.toolbarBottomSpaceConstraint.constant = show ? rect.size.height : 0
            }
        }
        
        keynode.animationsHandler = { [weak self] show, rect in
            if let me = self {
                me.toolbarBottomSpaceConstraint.constant = max(me.tableView.bounds.height - rect.origin.y, 0)
                me.view.layoutIfNeeded()
            }
        }
        
        tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
    }
}

extension FirstViewController: UITableViewDelegate, UITableViewDataSource {
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return tableSourceList.count
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tableSourceList[section].count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier("UITableViewCell", forIndexPath: indexPath) as UITableViewCell
        
        cell.textLabel?.text = tableSourceList[indexPath.section][indexPath.row]<commit_msg>written swift1.2<commit_after>//
//  FirstViewController.swift
//  KeynodeExample
//
//  Created by <NAME> on 2014/12/14.
//  Copyright (c) 2014年 kyohei_ito. All rights reserved.
//

import UIKit
import Keynode

class FirstViewController: UIViewController {
    let tableSourceList: [[String]] = [[Int](1...20).map{ "cell \($0)" }]
    
    @IBOutlet weak var toolbar: UIView!
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var toolbarBottomSpaceConstraint: NSLayoutConstraint!
    lazy var keynode: Keynode.Connector = Keynode.Connector(view: self.tableView)

    override func viewDidLoad() {
        super.viewDidLoad()
        
        keynode.defaultInsetBottom = toolbar.bounds.height
        keynode.willAnimationHandler = { [weak self] show, rect in
            if let me = self {
                me.toolbarBottomSpaceConstraint.constant = show ? rect.size.height : 0
            }
        }
        
        keynode.animationsHandler = { [weak self] show, rect in
            if let me = self {
                me.toolbarBottomSpaceConstraint.constant = max(me.tableView.bounds.height - rect.origin.y, 0)
                me.view.layoutIfNeeded()
            }
        }
        
        tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
    }
}

extension FirstViewController: UITableViewDelegate, UITableViewDataSource {
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return tableSourceList.count
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tableSourceList[section].count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("UITableViewCell", forIndexPath: indexPath) as! UITableViewCell
        
        cell.textLabel?.text = tableSourceList[indexPath.section][indexPath.row]
{'fraction_non_alphanumeric': 0.09246661627614008, 'fraction_numerical': 0.009574200050390527, 'mean_word_length': 2.8468992248062017, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4935863', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1110, 'n_words': 245}