Skip to content
Open
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
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AXComponentKitMacrosTests"
BuildableName = "AXComponentKitMacrosTests"
BlueprintName = "AXComponentKitMacrosTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AXComponentKitMacrosTests"
BuildableName = "AXComponentKitMacrosTests"
BlueprintName = "AXComponentKitMacrosTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
</Scheme>
202 changes: 47 additions & 155 deletions AXComponentKitSample/AXComponentKitSample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -27,6 +27,12 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:UITests/AXComponentKitSample.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import AXComponentKit
import SwiftUI

@main
struct AXComponentKitSampleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.automationOptimized()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import AXComponentKit
import AXComponentKitMacroSupport

@AXScreen
struct CatalogScreen {
let featuredCarousel: AXScrollView = "catalog-featured-carousel"
let categoryList: AXScrollView = "catalog-category-list"
let categoryCard: AXDynamicComponent<Category> = "catalog-category-card"
let featuredItem: AXDynamicComponent<Int> = "catalog-featured-item"
}
18 changes: 18 additions & 0 deletions AXComponentKitSample/AXComponentKitSample/AXScreens/Category.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import AXComponentKit
import Foundation

enum Category: String, CaseIterable, AXDynamicValue {
case electronics
case books
case clothing

var automationDynamicValue: String { rawValue }

var displayName: String {
switch self {
case .electronics: "Electronics"
case .books: "Books"
case .clothing: "Clothing"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import AXComponentKit
import AXComponentKitMacroSupport

@AXScreen
struct CategoryDetailScreen {
let itemList: AXScrollView = "category-detail-item-list"
let item: AXDynamicComponent<Int> = "category-detail-item"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import AXComponentKit
import Foundation

struct DetailScreen: AXScreen {
static let screenIdentifier = "detail-screen"
import AXComponentKitMacroSupport

@AXScreen
struct DetailScreen {
let contentLabel: AXComponent = "content-label"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import AXComponentKit
import Foundation

struct FirstTabScreen: AXScreen {
static let screenIdentifier = "first-tab-screen"
import AXComponentKitMacroSupport

@AXScreen
struct FirstTabScreen {
let detailButton: AXComponent = "first-tab-screen-detail-button"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import AXComponentKit
import AXComponentKitMacroSupport

@AXScreen
struct ItemDetailScreen {
let titleLabel: AXComponent = "item-detail-title-label"
let descriptionLabel: AXComponent = "item-detail-description-label"
let shareButton: AXComponent = "item-detail-share-button"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import AXComponentKit
import AXComponentKitMacroSupport

@AXScreen
struct ProfileScreen {
let profileField: AXDynamicComponent<String> = "profile-field"
let saveButton: AXComponent = "profile-save-button"
let closeButton: AXComponent = "profile-close-button"
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import AXComponentKit
import Foundation

struct SecondTabScreen: AXScreen {
static let screenIdentifier = "second-tab-screen"
import AXComponentKitMacroSupport

@AXScreen
struct SecondTabScreen {
let table: AXScrollView = "second-table-table-view"
let rowItem: AXDynamicComponent<Int> = "second-tab-dynamic-row"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import AXComponentKit
import AXComponentKitMacroSupport

@AXScreen
struct SettingsScreen {
let notificationsToggle: AXComponent = "settings-notifications-toggle"
let darkModeToggle: AXComponent = "settings-dark-mode-toggle"
let locationToggle: AXComponent = "settings-location-toggle"
let analyticsToggle: AXComponent = "settings-analytics-toggle"
let versionLabel: AXComponent = "settings-version-label"
let privacyButton: AXComponent = "settings-privacy-button"
let termsButton: AXComponent = "settings-terms-button"
let profileButton: AXComponent = "settings-profile-button"
let settingsList: AXScrollView = "settings-list-scroll-view"
let supportEmail: AXComponent = AXComponent(prefix: "settings", "support-email-label")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import AXComponentKit
import AXComponentKitMacroSupport

@AXScreen
struct ShareScreen {
let messageField: AXComponent = "share-message-field"
let sendButton: AXComponent = "share-send-button"
let dismissButton: AXComponent = "share-dismiss-button"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ struct ContentView: View {
.tabItem {
Label("Second", systemImage: "circle")
}
SettingsView()
.tabItem {
Label("Settings", systemImage: "gear")
}
CatalogView()
.tabItem {
Label("Catalog", systemImage: "square.grid.2x2")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import AXComponentKit
import SwiftUI

struct CatalogView: View {
@State private var path = NavigationPath()

private let featuredItems = 1 ... 8

var body: some View {
NavigationStack(path: $path) {
List {
Section("Featured") {
ScrollView(.horizontal) {
HStack(spacing: 12) {
ForEach(featuredItems, id: \.self) { index in
RoundedRectangle(cornerRadius: 8)
.fill(Color.blue.opacity(0.2))
.frame(width: 120, height: 80)
.overlay(Text("Item \(index)"))
.automationComponent(\CatalogScreen.featuredItem, value: index)
}
}
.padding(.horizontal)
}
.automationScrollView(\CatalogScreen.featuredCarousel)
.listRowInsets(EdgeInsets())
}

Section("Categories") {
ForEach(Category.allCases, id: \.self) { category in
Button(category.displayName) {
path.append(category)
}
.automationComponent(\CatalogScreen.categoryCard, value: category)
}
}
}
.automationScrollView(\CatalogScreen.categoryList)
.navigationTitle("Catalog")
.navigationDestination(for: Category.self) { category in
CategoryDetailView(category: category)
}
}
.automationScreen(CatalogScreen.self)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import AXComponentKit
import SwiftUI

struct CategoryDetailView: View {
let category: Category
private let items = 1 ... 50

var body: some View {
Form {
ForEach(items, id: \.self) { index in
NavigationLink("Item \(index)") {
ItemDetailView(itemIndex: index, category: category)
}
.automationComponent(\CategoryDetailScreen.item, value: index)
}
}
.automationScrollView(\CategoryDetailScreen.itemList)
.navigationTitle(category.displayName)
.automationScreen(CategoryDetailScreen.self)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import AXComponentKit
import SwiftUI

struct ItemDetailView: View {
let itemIndex: Int
let category: Category

@State private var showShare = false

var body: some View {
Form {
Section {
Text("Item \(itemIndex) — \(category.displayName)")
.automationComponent(\ItemDetailScreen.titleLabel)
Text("This is a detailed description of item \(itemIndex) in the \(category.displayName) category.")
.automationComponent(\ItemDetailScreen.descriptionLabel)
}

Section {
Button("Share") {
showShare = true
}
.automationComponent(\ItemDetailScreen.shareButton)
}
}
.navigationTitle("Item \(itemIndex)")
.sheet(isPresented: $showShare) {
ShareSheetView()
}
.automationScreen(ItemDetailScreen.self)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import AXComponentKit
import SwiftUI

struct ShareSheetView: View {
@Environment(\.dismiss) private var dismiss
@State private var message = ""

var body: some View {
NavigationStack {
Form {
Section("Message") {
TextField("Add a message…", text: $message, axis: .vertical)
.automationComponent(\ShareScreen.messageField)
}

Section {
Button("Send") {
dismiss()
}
.automationComponent(\ShareScreen.sendButton)
}
}
.navigationTitle("Share")
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button("Cancel") {
dismiss()
}
.automationComponent(\ShareScreen.dismissButton)
}
}
}
.automationScreen(ShareScreen.self)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import AXComponentKit
import SwiftUI

struct ProfileView: View {
@Environment(\.dismiss) private var dismiss

private let fields = ["name", "email", "phone"]

@State private var name = "Jane Doe"
@State private var email = "jane@example.com"
@State private var phone = "555-1234"

var body: some View {
NavigationStack {
Form {
Section("Personal Information") {
TextField("Name", text: $name)
.automationComponent(\ProfileScreen.profileField, value: "name")
TextField("Email", text: $email)
.automationComponent(\ProfileScreen.profileField, value: "email")
TextField("Phone", text: $phone)
.automationComponent(\ProfileScreen.profileField, value: "phone")
}

Section {
Button("Save") {}
.automationComponent(\ProfileScreen.saveButton)
}
}
.navigationTitle("Profile")
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button("Close") {
dismiss()
}
.automationComponent(\ProfileScreen.closeButton)
}
}
}
.automationScreen(ProfileScreen.self)
}
}
Loading