Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support user input label #24

Merged
merged 6 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/cashapp/AccessibilitySnapshot.git",
"state" : {
"revision" : "482db2fd4251cce237d8106073a53ad5289ce739",
"version" : "0.6.0"
"revision" : "ef2cf6015ad00c791fe3ff60f836b1fcc50f970c",
"version" : "0.7.0"
}
},
{
Expand All @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/playbook-ui/playbook-ios.git",
"state" : {
"revision" : "0e7c312abdb4f7afeaf24369bab114cf475f573c",
"version" : "0.3.5"
"revision" : "da86a1a533e7ab5b1203908dfbb33aa38b782421",
"version" : "0.4.1"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Example/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# How to Run

1. Open `Example.xcodeproj` via Xcode
1. Run (⌘+R) `Sample` scheme
1. Run test (⌘+U) `Sample` sceme to generate snapshot images
1. Run (⌘+R) `SampleApp` scheme
1. Run test (⌘+U) `SampleApp` sceme to generate snapshot images
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import UIKit
public final class RepresentableUIView: UIView {
public var color: UIColor

public init(_ color: UIColor) {
public init(_ color: UIColor, accessibilityUserInputLabels: [String]) {
self.color = color
super.init(frame: .zero)
self.isAccessibilityElement = true
self.accessibilityUserInputLabels = accessibilityUserInputLabels
layer.backgroundColor = color.cgColor
layer.cornerRadius = defaultCornerRadius
layer.borderColor = UIColor.black.cgColor
Expand All @@ -29,7 +30,7 @@ public final class RepresentableUIView: UIView {

public struct RepresentableView: UIViewRepresentable {
public func makeUIView(context: UIViewRepresentableContext<RepresentableView>) -> RepresentableUIView {
return RepresentableUIView(.red)
return RepresentableUIView(.red, accessibilityUserInputLabels: ["Red", "Rectangular"])
}

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

public final class RepresentableUIViewController: UIViewController {
public override func loadView() {
self.view = RepresentableUIView(.blue)
self.view = RepresentableUIView(.blue, accessibilityUserInputLabels: ["Blue", "Rectangular"])
}
}

Expand Down
24 changes: 12 additions & 12 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/cashapp/AccessibilitySnapshot.git",
"state" : {
"revision" : "482db2fd4251cce237d8106073a53ad5289ce739",
"version" : "0.6.0"
"revision" : "ef2cf6015ad00c791fe3ff60f836b1fcc50f970c",
"version" : "0.7.0"
}
},
{
Expand Down Expand Up @@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/playbook-ui/playbook-ios.git",
"state" : {
"revision" : "0e7c312abdb4f7afeaf24369bab114cf475f573c",
"version" : "0.3.5"
"revision" : "da86a1a533e7ab5b1203908dfbb33aa38b782421",
"version" : "0.4.1"
}
},
{
Expand All @@ -86,17 +86,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
"revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b",
"version" : "1.4.0"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-cmark.git",
"state" : {
"revision" : "f218e5d7691f78b55bfa39b367763f4612486c35",
"version" : "0.3.0"
"revision" : "3bc2f3e25df0cecc5dc269f7ccae65d0f386f06a",
"version" : "0.4.0"
}
},
{
Expand All @@ -113,8 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-markdown.git",
"state" : {
"revision" : "e4f95e2dc23097a1a9a1dfdfe3fe3ee44de77378",
"version" : "0.3.0"
"revision" : "4aae40bf6fff5286e0e1672329d17824ce16e081",
"version" : "0.4.0"
}
},
{
Expand Down Expand Up @@ -176,8 +176,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/Yams.git",
"state" : {
"revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
"version" : "5.0.6"
"revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d",
"version" : "5.1.3"
}
}
],
Expand Down
6 changes: 2 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ let package = Package(
dependencies: [
.package(
url: "https://github.com/playbook-ui/playbook-ios.git",
.upToNextMinor(from: "0.3.5")
.upToNextMinor(from: "0.4.1")
),
.package(
url: "https://github.com/cashapp/AccessibilitySnapshot.git",
.upToNextMinor(from: "0.6.0")
.upToNextMinor(from: "0.7.0")
),
],
targets: [
Expand All @@ -39,7 +39,5 @@ if ProcessInfo.processInfo.environment["PLAYBOOK_DEVELOPMENT"] != nil {
package.dependencies.append(contentsOf: [
.package(url: "https://github.com/apple/swift-format.git", exact: "509.0.0"),
.package(url: "https://github.com/yonaskolb/XcodeGen.git", exact: "2.38.0"),
// XcodeGen fails to build with newer version of XcodeProj
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.15.0"),
])
}
3 changes: 2 additions & 1 deletion Sources/AccessibilitySnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public struct AccessibilitySnapshot: TestTool {
let accessibilityView = AccessibilitySnapshotView(
containedView: view.superview ?? view,
viewRenderingMode: .renderLayerInContext,
activationPointDisplayMode: .always
activationPointDisplayMode: .always,
showUserInputLabels: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default opt in, this is mandatory to provide to adopt 0.7.0

)

// Ignoring the error thrown by the parse function. It will be handled correctly
Expand Down
Loading