   func testSwiftCustomMatcher() {
     // Verify description in custom matcher isn't nil.
     // unexpectedly found nil while unwrapping an Optional value
-    EarlGrey.select(elementWithMatcher: grey_allOf([grey_firstElement(),
-                                                    grey_text("FooText")]))
+    EarlGrey.select(elementWithMatcher: grey_allOf([grey_firstElement(), grey_text("FooText")]))
       .assert(grey_nil())
   }
 
   func testInteractionWithALabelWithParentHidden() {
-    let checkHiddenBlock:GREYActionBlock =
+    let checkHiddenBlock =
       GREYActionBlock.action(withName: "checkHiddenBlock", perform: { element, errorOrNil in
         // Check if the found element is hidden or not.
-        let superView:UIView! = element as! UIView
+        let superView = element as! UIView
         return !superView.isHidden
       })
 
-    self.openTestView("Basic Views")
+    openTestView("Basic Views")
     EarlGrey.select(elementWithMatcher: grey_text("Tab 2")).perform(grey_tap())
     EarlGrey.select(elementWithMatcher: grey_accessibilityLabel("tab2Container"))
       .perform(checkHiddenBlock).assert(grey_sufficientlyVisible())
     var error: NSError?
     EarlGrey.select(elementWithMatcher: grey_text("Non Existent Element"))
-      .perform(grey_tap(), error:&error)
+      .perform(grey_tap(), error: &error)
     if let errorVal = error {
-      GREYAssertEqual(errorVal.domain as AnyObject?, kGREYInteractionErrorDomain as AnyObject?,
-                      reason: "Element Not Found Error")
+      GREYAssertEqualObjects(errorVal.domain,
+                             kGREYInteractionErrorDomain,
+                             reason: "Element Not Found Error")
     }
   }
 
   func testChangingDatePickerToAFutureDate() {
-    self.openTestView("Picker Views")
+    openTestView("Picker Views")
     // Have an arbitrary date created
     let dateFormatter = DateFormatter()
     dateFormatter.dateStyle = .medium


class FTRSwiftTests: XCTestCase {

  override func tearDown() {
    super.tearDown()
    let delegateWindow:UIWindow! = UIApplication.shared.delegate!.window!
    var navController:UINavigationController?
    if ((delegateWindow.rootViewController?.isKind(of: UINavigationController.self)) != nil) {
      navController = delegateWindow.rootViewController as? UINavigationController
    } else {
      navController = delegateWindow.rootViewController!.navigationController
    }
    _ = navController?.popToRootViewController(animated: true)
  }

  func testOpeningView() {
    self.openTestView("Typing Views")
  }

  func testRotation() {
    EarlGrey.rotateDeviceTo(orientation: UIDeviceOrientation.landscapeLeft, errorOrNil: nil)
    EarlGrey.rotateDeviceTo(orientation: UIDeviceOrientation.portrait, errorOrNil: nil)
  }

  func testTyping() {
    self.openTestView("Typing Views")
    let matcher = grey_accessibilityID("TypingTextField")
    let action = grey_typeText("Sample Swift Test")
    let assertionMatcher = grey_text("Sample Swift Test")

  }

  func testTypingWithDeletion() {
    openTestView("Typing Views")
    EarlGrey.select(elementWithMatcher: grey_accessibilityID("TypingTextField"))
      .perform(grey_typeText("Fooo\u{8}B\u{8}Bar"))
      .assert(grey_text("FooBar"))
  }

  func testButtonPressWithGREYAllOf() {
    openTestView("Basic Views")
    EarlGrey.select(elementWithMatcher: grey_text("Tab 2")).perform(grey_tap())
    let matcher = grey_allOf([grey_text("Long Press"), grey_sufficientlyVisible()])
    EarlGrey.select(elementWithMatcher: matcher).perform(grey_longPressWithDuration(1.1))
