Attest
public class Attest : NSObject
Use Attest to start analysis for manual or automated testing. The two functions that are needed for manual testing are
Attest.startServer(_ port: )
and
Attest.stopServer()
These should be called in the AppDelegate. See these two functions for more details.
Note
VoiceOver should always be on for manual testing if highlighting the violating view is desired.In automated testing, use the functions Attest.that().isAccessible()
to look for accessibility violations in a specified UIViewController. Attest uses a sub-class called Assert
to run the analysis, and another sub-class called Result
to display the results from the analysis.
Attest is initialized by calling one of three that
functions. A that
function will automatically create an Assert class, which will be used to run the analyzer. Examples of this include:
Attest.that(view: myView).isAccessible()
Attest.that(viewController: myViewController.isAccessible()
Attest.that(storyBoardName: "Storyboard Name", viewControllerID: "UIViewController ID", bundle: "UIBundle Name").isAccessible()
Attest.that(storyBoardName: "Storyboard Name", viewControllerID: "UIViewController ID").isAccessible()
Attest.that(storyBoardName: "Storyboard Name").isAccessible()
Please see the isAccessible()
functions and the that()
functions for more information on their correct usages.
-
This function connects the testing device and the Attest framework to the Attest Mobile UI Client. Both this function and
stopServer
should be used for manually testing accessibility. Call this function inapplicationDidBecomeActive,
which is in AppDelegate.swift.Declaration
Swift
public static func startServer(_ port: UInt)
Parameters
port
UInt of the port number that should be used to connect the device to Attest. For simulators and devices, use
48484.
Return Value
None.
-
This function stops the connection between the testing device and the Attest framework to the Attest Mobile UI Client. Both this function and
startServer
should be used for manually testing accessibility. Call this function inapplicationWillResignActive,
which is in AppDelegate.swift.Declaration
Swift
public static func stopServer()
Return Value
None.
-
Force loads the view and returns an initialized Assert. Usually used with Assert.isAccessible(), such as the following:
Attest.that(view: myView).isAccessible()
Declaration
Swift
public static func that(view:UIView) -> Assert
Parameters
view
The superview that will be analyzed. This is usually the view of the view controller.
Return Value
Assert class, initialized with view. This can be used to call the
isAccessible()
function on the UIViewController. -
Force loads the viewController’s view and returns an initialized Assert. This is usually used with Assert.isAccessible(), such as the following:
Attest.that(viewController: myViewController).isAccessible()
Declaration
Swift
public static func that(viewController:UIViewController) -> Assert
Parameters
viewController
the UIViewController that will be analyzed.
Return Value
Assert class, initialized with viewController’s view. This can be used to call the
isAccessible()
function on the UIViewController. -
If an identifier is listed, it will initialize an Assert with the UIViewController that matches the identifier. Otherwise, it will initialize an Assert with the initial UIViewController. This is usually used with Assert.isAccessible(). An example of this is as follows:
Attest.that(storyBoardName: "Main", viewControllerID: "UIViewControllerID").isAccessible()
Declaration
Swift
public static func that(storyBoardName:String, viewControllerID:String? = nil, bundle:Bundle? = nil) -> Assert
Parameters
storyBoardName
The name of the UIStoryboard that contains the UIViewController that should be analyzed, as a String. This cannot be null.
viewControllerID
The ID of the UIViewController that should be analyzed, as a String. If it is not specified, it will analyze the initial UIViewController.
bundle
The bundle of the UIStoryboard, as a Bundle. If none is listed, it will be null.
Return Value
Assert class, initialized with either the UIViewController that matches the ViewControllerID, or the initial UIViewController in the UIStoryboard. This can be used to call the
isAccessible()
function on the UIViewController. -
Users should not need to create individual instances of Assert by themselves; rather, an Assert will automatically be initialized by calling one of the
See morethat
functions in theAttest
class. See the Attest class for more information.Declaration
Swift
public class Assert : NSObject
-
A class containing all of the results from the analysis.
See moreDeclaration
Swift
public class Result : NSObject