<commit_before>//
//  ViewController.swift
//  DifferentWaysToPassValueSwift
//
//  Created by Linus on 15-9-1.
//  Copyright (c) 2015年 Linus. All rights reserved.
//

import UIKit

class RootViewController: UIViewController, delegateOfNegative {
    
    @IBOutlet weak var delegateTF: UITextField!
    
    @IBOutlet weak var blockTF: UITextField!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        println("RootViewController viewDidLoad")
    }
    
    @IBAction func delegateButtonDidTapped(sender: AnyObject) {
        
        var title = self.delegateTF.text
        
        var del:DelegateViewController = DelegateViewController()
        del.positiveValue = title //正向传值
        self.presentViewController(del, animated: true, completion: nil)
        
        del.delegate = self //设置下一个VC的delegate为当前的rootVC
    }
    
    //实现delegate的方法
    func passValue(str:String) {
        self.delegateTF.text = str
    }
    
    // ------------------------------------
    
    @IBAction func blockButtonDidTapped(sender: AnyObject) {
        self.saveUD(self.blockTF.text)
        
        var blo:BlockViewController = BlockViewController()
        
        //设置block中要传递的值的接收方式
        blo.passBlockValue = {
            (title:String) in
            self.blockTF.text = title
            
        }
        
        self.presentViewController(blo, animated: true, completion: nil)
        
    }
    
    func saveUD(title:String) {<commit_msg>add demo.gif<commit_after>//
//  ViewController.swift
//  DifferentWaysToPassValueSwift
//
//  Created by Linus on 15-9-1.
//  Copyright (c) 2015年 Linus. All rights reserved.
//

import UIKit

class RootViewController: UIViewController, delegateOfNegative {
    
    @IBOutlet weak var delegateTF: UITextField!
    
    @IBOutlet weak var blockTF: UITextField!
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        println("RootViewController viewDidLoad")
    }
    
    @IBAction func delegateButtonDidTapped(sender: AnyObject) {
        
        var title = self.delegateTF.text
        
        var del:DelegateViewController = DelegateViewController()
        del.positiveValue = title //正向传值
        self.presentViewController(del, animated: true, completion: nil)
        
        del.delegate = self //设置下一个VC的delegate为当前的rootVC
    }
    
    //实现delegate的方法
    func passValue(str:String) {
        self.delegateTF.text = str
    }
    
    // ------------------------------------
    
    @IBAction func blockButtonDidTapped(sender: AnyObject) {
        self.saveUD(self.blockTF.text)
        
        var blo:BlockViewController = BlockViewController()
        
        //设置block中要传递的值的接收方式
        blo.passBlockValue = {
            (title:String) in
            self.blockTF.text = title
        }
        
        self.presentViewController(blo, animated: true, completion: nil)
        
    }
    
    func saveUD(title:String) {
{'fraction_non_alphanumeric': 0.10555196901226598, 'fraction_numerical': 0.005164622336991607, 'mean_word_length': 2.002906976744186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6443878', 'n_tokens_mistral': 926, 'n_tokens_neox': 881, 'n_words': 193}