Writing a unit-test for a class extension in Swift
问题 I'm attempting to write a unit test for a class extension in Swift. The class extension itself will present a UIAlert with a specified title and message as such: extension UIViewController { func presentAlert(title: String, message : String) { let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert) alertController.addAction(UIAlertAction(title: "Close", style: UIAlertActionStyle.Default, handler: nil)) UIApplication.sharedApplication().keyWindow?