 //  Copyright (c) 2014 jakeheis. All rights reserved.
 //
 
+import Foundation
+
 public class Input {
     
     //  MARK: - Public

                    printMessage += " "
                }
                print(printMessage, terminator: "")
            }
            input = readLine()
        }
        
        return input!
    }
    
    /**
        Awaits a string of valid input; continues accepting input until the given input is determined to be valid
        - Parameter message: message to be printed before accepting input (e.g. "Name: ")
        - Parameter validation: closure evaluating whether the given input was valid
    */
    public static func awaitInputWithValidation(message: String?, validation: (_ input: String) -> Bool) -> String {
        while (true) {
            let str = awaitInput(message: message)
            
            if validation(str) {
                return str
            } else {

    /**
        Awaits a string of convertible input; continues accepting input until the given input is successfully converted
        - Parameter message: message to be printed before accepting input (e.g. "Name: ")
        - Parameter secure: boolean defining that input should be hidden
        - Parameter conversion: closure attempting to convert the input to the desired output
    */
    public static func awaitInputWithConversion<T>(message: String?, secure: Bool = false, conversion: (_ input: String) -> T?) -> T {
        let input = awaitInputWithValidation(message: message, secure: secure) { (input) in
            return conversion(input) != nil
        }
        
