From 7563d73ea5e9ebed04f6786d94e9368b4d01170d Mon Sep 17 00:00:00 2001 From: Cooper Knaak Date: Thu, 10 Aug 2023 10:06:28 -0700 Subject: [PATCH] Update README to include explicit Swift examples. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index adcf08a..2724e11 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ accessibility label) on all elements on the screen. To install GTXiLib on all the tests of a specific test class add the following snippet of code to it. +In Objective-C. Note that GTX is installed in the class `+ (void)setUp`, not the instance `- (void)setUp`. + ```objective-c // Include the GTXiLib umbrella header. @@ -37,6 +39,17 @@ snippet of code to it. } ``` +In Swift. Note that GTX is installed in the class `class func setUp`, not the instance `func setUp()`. + +```swift +override class func setUp() { + super.setUp() + + let checksToBeInstalled = GTXChecksCollection.allGTXChecks()! + GTXiLib.install(on: GTXTestSuite(allTestsIn: self)!, checks: checksToBeInstalled, elementExcludeLists: []) +} +``` + Once installed, GTX will run all registered accessibility checks before test case tearDown and fail the test if any accessibility checks fail. With the above snippet of code your tests will now begin to catch issues where you have added