Skip to content

Commit 6d87fbc

Browse files
authored
Merge pull request #24 from rasberik/feature/support-user-input-label
Feature: Support user input label
2 parents ecdfa87 + 6a85260 commit 6d87fbc

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# How to Run
22

33
1. Open `Example.xcodeproj` via Xcode
4-
1. Run (⌘+R) `Sample` scheme
5-
1. Run test (⌘+U) `Sample` sceme to generate snapshot images
4+
1. Run (⌘+R) `SampleApp` scheme
5+
1. Run test (⌘+U) `SampleApp` sceme to generate snapshot images

Example/SampleApp/AccessibilityExamples/RepresentableExample_iOS.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import UIKit
1212
public final class RepresentableUIView: UIView {
1313
public var color: UIColor
1414

15-
public init(_ color: UIColor) {
15+
public init(_ color: UIColor, accessibilityUserInputLabels: [String]) {
1616
self.color = color
1717
super.init(frame: .zero)
1818
self.isAccessibilityElement = true
19+
self.accessibilityUserInputLabels = accessibilityUserInputLabels
1920
layer.backgroundColor = color.cgColor
2021
layer.cornerRadius = defaultCornerRadius
2122
layer.borderColor = UIColor.black.cgColor
@@ -29,7 +30,7 @@ public final class RepresentableUIView: UIView {
2930

3031
public struct RepresentableView: UIViewRepresentable {
3132
public func makeUIView(context: UIViewRepresentableContext<RepresentableView>) -> RepresentableUIView {
32-
return RepresentableUIView(.red)
33+
return RepresentableUIView(.red, accessibilityUserInputLabels: ["Red", "Rectangular"])
3334
}
3435

3536
public func updateUIView(_ nsView: RepresentableUIView, context: UIViewRepresentableContext<RepresentableView>) {
@@ -40,7 +41,7 @@ public struct RepresentableView: UIViewRepresentable {
4041

4142
public final class RepresentableUIViewController: UIViewController {
4243
public override func loadView() {
43-
self.view = RepresentableUIView(.blue)
44+
self.view = RepresentableUIView(.blue, accessibilityUserInputLabels: ["Blue", "Rectangular"])
4445
}
4546
}
4647

Package.resolved

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ let package = Package(
1515
dependencies: [
1616
.package(
1717
url: "https://github.com/playbook-ui/playbook-ios.git",
18-
.upToNextMinor(from: "0.3.5")
18+
.upToNextMinor(from: "0.4.1")
1919
),
2020
.package(
2121
url: "https://github.com/cashapp/AccessibilitySnapshot.git",
22-
.upToNextMinor(from: "0.6.0")
22+
.upToNextMinor(from: "0.7.0")
2323
),
2424
],
2525
targets: [
@@ -39,7 +39,5 @@ if ProcessInfo.processInfo.environment["PLAYBOOK_DEVELOPMENT"] != nil {
3939
package.dependencies.append(contentsOf: [
4040
.package(url: "https://github.com/apple/swift-format.git", exact: "509.0.0"),
4141
.package(url: "https://github.com/yonaskolb/XcodeGen.git", exact: "2.38.0"),
42-
// XcodeGen fails to build with newer version of XcodeProj
43-
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.15.0"),
4442
])
4543
}

Sources/AccessibilitySnapshot.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public struct AccessibilitySnapshot: TestTool {
4343
let accessibilityView = AccessibilitySnapshotView(
4444
containedView: view.superview ?? view,
4545
viewRenderingMode: .renderLayerInContext,
46-
activationPointDisplayMode: .always
46+
activationPointDisplayMode: .always,
47+
showUserInputLabels: true
4748
)
4849

4950
// Ignoring the error thrown by the parse function. It will be handled correctly

0 commit comments

Comments
 (0)