//
//  PromptSettings.swift
//  PromptSettings
//
//  Created by Omar Abdelhafith on 02/11/2015.
//  Copyright © 2015 Omar Abdelhafith. All rights reserved.
//

import Foundation


class PromptSettings {
    
    static var reader: PromptReader = ConsolePromptReader()
    static var printer: PromptPrinter = ConsolePromptPrinter()
    
    class func read() -> String? {
        return reader.read()
    }
    
    class func print(string: String, terminator: String = "\n") {
        return printer.printString(string, terminator: terminator)
    }
}
//
//  PromptSettings.swift
//  PromptSettings
//
//  Created by Omar Abdelhafith on 02/11/2015.
//  Copyright © 2015 Omar Abdelhafith. All rights reserved.
//

import Foundation


class PromptSettings {
    
    static var reader: PromptReader!
    static var printer: PromptPrinter!
    
    class func getReader() -> PromptReader {
        if let reader = PromptSettings.reader {
            return reader
        } else {
            return ConsolePromptReader()
        }
    }
    
    class func getPrinter() -> PromptPrinter {
        if let printer = PromptSettings.printer {
            return printer
        } else {
            return ConsolePromptPrinter()
        }
    }
    
    class func read() -> String? {
        return getReader().read()
    }
    
    class func print(string: String, terminator: String = "\n") {
        return getPrinter().printString(string, terminator: terminator)
    }
}
--- 
+++ 
@@ -11,30 +11,14 @@
 
 class PromptSettings {
     
-    static var reader: PromptReader!
-    static var printer: PromptPrinter!
-    
-    class func getReader() -> PromptReader {
-        if let reader = PromptSettings.reader {
-            return reader
-        } else {
-            return ConsolePromptReader()
-        }
-    }
-    
-    class func getPrinter() -> PromptPrinter {
-        if let printer = PromptSettings.printer {
-            return printer
-        } else {
-            return ConsolePromptPrinter()
-        }
-    }
+    static var reader: PromptReader = ConsolePromptReader()
+    static var printer: PromptPrinter = ConsolePromptPrinter()
     
     class func read() -> String? {
-        return getReader().read()
+        return reader.read()
     }
     
     class func print(string: String, terminator: String = "\n") {
-        return getPrinter().printString(string, terminator: terminator)
+        return printer.printString(string, terminator: terminator)
     }
 }
Use swift lazy vars magic
