Skip to content
Draft
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
15 changes: 3 additions & 12 deletions AccessibilitySnapshot.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,15 @@ Pod::Spec.new do |s|

s.ios.deployment_target = '13.0'

s.default_subspecs = 'Core', 'SnapshotTesting'

s.subspec 'Core' do |ss|
ss.source_files = 'Sources/AccessibilitySnapshot/Core/Swift/Classes/**/*.swift', 'Sources/AccessibilitySnapshot/Core/ObjC/**/*.{h,m}'
ss.public_header_files = 'Sources/AccessibilitySnapshot/Core/ObjC/include/*.h'
ss.resources = 'Sources/AccessibilitySnapshot/Core/Swift/Assets/**/*.{strings,xcassets}'
ss.resource_bundles = {
'AccessibilitySnapshot' => ['Sources/AccessibilitySnapshot/Core/Swift/Assets/**/*.{strings,xcassets}']
}
end
s.default_subspecs = 'SnapshotTesting'

s.subspec 'iOSSnapshotTestCase' do |ss|
ss.source_files = 'Sources/AccessibilitySnapshot/iOSSnapshotTestCase/**/*.{swift,h,m}'
ss.public_header_files = [
'Sources/AccessibilitySnapshot/iOSSnapshotTestCase/ObjC/include/*.h',
]

ss.dependency 'AccessibilitySnapshot/Core'
ss.dependency 'AccessibilitySnapshotCore'
ss.dependency 'iOSSnapshotTestCase', '~> 8.0'
ss.frameworks = 'XCTest'
ss.weak_frameworks = 'XCTest'
Expand All @@ -38,7 +29,7 @@ Pod::Spec.new do |s|
s.subspec 'SnapshotTesting' do |ss|
ss.source_files = 'Sources/AccessibilitySnapshot/SnapshotTesting/**/*.{swift,h,m}'

ss.dependency 'AccessibilitySnapshot/Core'
ss.dependency 'AccessibilitySnapshotCore'
ss.dependency 'SnapshotTesting', '~> 1.0'
ss.frameworks = 'XCTest'
ss.weak_frameworks = 'XCTest'
Expand Down
21 changes: 21 additions & 0 deletions AccessibilitySnapshotCore.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Pod::Spec.new do |s|
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to create a new podspec to be able to import AccessibilitySnapshotCore into the code files with the previews.

s.name = 'AccessibilitySnapshotCore'
s.version = '0.6.0'
s.summary = 'Easy regression testing for iOS accessibility'

s.homepage = 'https://github.com/CashApp/AccessibilitySnapshot'
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
s.authors = 'Square'
s.source = { :git => 'https://github.com/CashApp/AccessibilitySnapshot.git', :tag => s.version.to_s }

s.swift_version = '5.0.1'

s.ios.deployment_target = '13.0'

s.source_files = 'Sources/AccessibilitySnapshot/Core/Swift/Classes/**/*.swift', 'Sources/AccessibilitySnapshot/Core/ObjC/**/*.{h,m}','Sources/AccessibilitySnapshot/Core/Swift/AccessibilityPreview/**/*.swift'
s.public_header_files = 'Sources/AccessibilitySnapshot/Core/ObjC/include/*.h'
s.resources = 'Sources/AccessibilitySnapshot/Core/Swift/Assets/**/*.{strings,xcassets}'
s.resource_bundles = {
'AccessibilitySnapshot' => ['Sources/AccessibilitySnapshot/Core/Swift/Assets/**/*.{strings,xcassets}']
}
end
4 changes: 4 additions & 0 deletions Example/AccessibilitySnapshot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
1104A8CE2B580AC500B6715F /* SwiftUITextEntry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUITextEntry.swift; sourceTree = "<group>"; };
1104A8D02B595FF600B6715F /* TextFieldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldViewController.swift; sourceTree = "<group>"; };
112909BB2B63E57B00B4EBEB /* TextViewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewViewController.swift; sourceTree = "<group>"; };
11D41CA12B989D7C005FD932 /* AccessibilitySnapshot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AccessibilitySnapshot.framework; sourceTree = BUILT_PRODUCTS_DIR; };
11D41CA32B989DEF005FD932 /* AccessibilitySnapshot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AccessibilitySnapshot.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1635CE4D251EAC6700907101 /* SnapshotTestingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnapshotTestingTests.swift; sourceTree = "<group>"; };
358D84DCD315110A89BD052E /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = "<group>"; };
3A3192D7B9B16BD10FB517A2 /* Pods_SnapshotTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SnapshotTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -355,6 +357,8 @@
63E74EA01571917A22FCFF95 /* Frameworks */ = {
isa = PBXGroup;
children = (
11D41CA32B989DEF005FD932 /* AccessibilitySnapshot.framework */,
11D41CA12B989D7C005FD932 /* AccessibilitySnapshot.framework */,
6A886964D2E787399E137105 /* Pods_AccessibilitySnapshotDemo.framework */,
3A3192D7B9B16BD10FB517A2 /* Pods_SnapshotTests.framework */,
0BFCB4FD6BC17AB232B26E72 /* Pods_UnitTests.framework */,
Expand Down
36 changes: 31 additions & 5 deletions Example/AccessibilitySnapshot/SwiftUITextEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,49 @@
// limitations under the License.
//

import AccessibilitySnapshotCore
import SwiftUI

struct SwiftUITextEntry: View {
@State private var textField1 = ""
@State private var textField2 = "Value in Text Field"
@State private var textEditor1 = ""

var body: some View {
VStack {
TextField("SwiftUI Text Field", text: .constant(""))
TextField("SwiftUI Text Field", text: .constant("Value in Text Field"))
TextField("SwiftUI Text Field", text: $textField1)
TextField("SwiftUI Text Field", text: $textField2)
if #available(iOS 14.0, *) {
TextEditor(text: .constant(""))
TextEditor(text: $textEditor1)
.frame(height: 300)
}
}
}
}

struct Preview: View {
@State private var isPresented = true

var body: some View {
if #available(iOS 15.0, *) {
SwiftUITextEntry()
.accessibilityPreview(isPresented: $isPresented)
} else {
SwiftUITextEntry()
}
}
}

struct SwiftUITextEntry_Previews: PreviewProvider {
static var previews: some View {
SwiftUITextEntry()
.previewLayout(.sizeThatFits)
if #available(iOS 15.0, *) {
SwiftUITextEntry()
.accessibilityPreview()
// Preview()
.previewLayout(.sizeThatFits)
} else {
SwiftUITextEntry()
.previewLayout(.sizeThatFits)
}
}
}
4 changes: 3 additions & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ use_modular_headers!
platform :ios, '13.0'

target 'AccessibilitySnapshotDemo' do
pod 'AccessibilitySnapshotCore', :path => '../AccessibilitySnapshotCore.podspec'
pod 'Paralayout', '= 1.0.0-rc.5'

target 'SnapshotTests' do
inherit! :search_paths

pod 'AccessibilitySnapshotCore', :path => '../AccessibilitySnapshotCore.podspec'
pod 'AccessibilitySnapshot/iOSSnapshotTestCase', :path => '../AccessibilitySnapshot.podspec'
pod 'AccessibilitySnapshot/SnapshotTesting', :path => '../AccessibilitySnapshot.podspec'

Expand All @@ -19,7 +21,7 @@ target 'AccessibilitySnapshotDemo' do
target 'UnitTests' do
inherit! :search_paths

pod 'AccessibilitySnapshot/Core', :path => '../AccessibilitySnapshot.podspec'
pod 'AccessibilitySnapshotCore', :path => '../AccessibilitySnapshotCore.podspec'
end
end

Expand Down
15 changes: 9 additions & 6 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PODS:
- AccessibilitySnapshot/Core (0.6.0)
- AccessibilitySnapshot/iOSSnapshotTestCase (0.6.0):
- AccessibilitySnapshot/Core
- AccessibilitySnapshotCore
- iOSSnapshotTestCase (~> 8.0)
- AccessibilitySnapshot/SnapshotTesting (0.6.0):
- AccessibilitySnapshot/Core
- AccessibilitySnapshotCore
- SnapshotTesting (~> 1.0)
- AccessibilitySnapshotCore (0.6.0)
- iOSSnapshotTestCase (8.0.0):
- iOSSnapshotTestCase/SwiftSupport (= 8.0.0)
- iOSSnapshotTestCase/Core (8.0.0)
Expand All @@ -15,9 +15,9 @@ PODS:
- SnapshotTesting (1.7.2)

DEPENDENCIES:
- AccessibilitySnapshot/Core (from `../AccessibilitySnapshot.podspec`)
- AccessibilitySnapshot/iOSSnapshotTestCase (from `../AccessibilitySnapshot.podspec`)
- AccessibilitySnapshot/SnapshotTesting (from `../AccessibilitySnapshot.podspec`)
- AccessibilitySnapshotCore (from `../AccessibilitySnapshotCore.podspec`)
- Paralayout (= 1.0.0-rc.5)
- SnapshotTesting (= 1.7.2)

Expand All @@ -30,13 +30,16 @@ SPEC REPOS:
EXTERNAL SOURCES:
AccessibilitySnapshot:
:path: "../AccessibilitySnapshot.podspec"
AccessibilitySnapshotCore:
:path: "../AccessibilitySnapshotCore.podspec"

SPEC CHECKSUMS:
AccessibilitySnapshot: 19f165d0397a18f7dd8dbc5f3396e5670c75a1a4
AccessibilitySnapshot: 0b9fcf5147cd7330c8752adbe499bef466b5110a
AccessibilitySnapshotCore: 6f7fd2b00641c6670c267d830559412d9dd98cd5
iOSSnapshotTestCase: a670511f9ee3829c2b9c23e6e68f315fd7b6790f
Paralayout: 844978af530a061a31d849c7b554510190b9cddf
SnapshotTesting: 8caa6661fea7c8019d5b46de77c16bab99c36c5c

PODFILE CHECKSUM: de5390900844b21156469b30e094a6bba820f0df
PODFILE CHECKSUM: e150693187722707ffed788dd0840565ad4803df

COCOAPODS: 1.11.3
1 change: 1 addition & 0 deletions Example/SnapshotTests/HitTargetTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//

import AccessibilitySnapshot
import AccessibilitySnapshotCore
import FBSnapshotTestCase
import Paralayout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
//

import AccessibilitySnapshot
import AccessibilitySnapshotCore
import UIKit
import XCTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
//

@import AccessibilitySnapshot;
@import AccessibilitySnapshotCore;
@import XCTest;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import XCTest

@testable import AccessibilitySnapshot
@testable import AccessibilitySnapshotCore

final class UIAccessibilityStatusUtilityTests: XCTestCase {

Expand Down
Loading