S.Boy S.Boy - 25 days ago 9
Swift Question

How to check whether the keyboard is shown or not?

I'm using

EarlGrey
for automated UI testing on an iOS project. I want to check whether the keyboard is shown or not after swiping away on the screen.

I've seen the header file in
EarlGrey
framework named GREYKeyboard.h with a function named
isKeyboardShown
with a bool return value. This would be very helpful for me, but I don't know how to use it since I have no access to this API.

EarlGrey
is installed with
Carthage
.

Answer Source

I've found the solution. You can access to GREYKeyboard.h (which is a private header) by editing the module.modulemap file. Add the

header "../PrivateHeaders/GREYKeyboard.h"

line to the file. The module.modulemap file should look like this after editing:

 framework module EarlGrey {
  umbrella header "EarlGrey.h"

  header "../PrivateHeaders/GREYKeyboard.h"
  export *
  module * { export * }
}