Use atproto actions with ease in iOS shortcuts
at main 2.1 kB view raw
1// 2// ExampleView.swift 3// shortcut 4// 5// Created by Bailey Townsend on 7/8/25. 6// 7 8import SwiftUI 9 10struct ExampleView: View { 11 let example: Example 12 13 var body: some View { 14 ScrollView { 15 VStack(alignment: .leading, spacing: 16) { 16 HStack(spacing: 12) { 17 Image(systemName: example.icon) 18 .font(.system(size: 40)) 19 .foregroundColor(.accentColor) 20 Text(example.title) 21 .font(.title) 22 .fontWeight(.bold) 23 } 24 25 Text(example.description) 26 .font(.body) 27 28 if !example.shortcutActionsUsed.isEmpty { 29 VStack(alignment: .leading, spacing: 8) { 30 Text("Used Shortcut Actions") 31 .font(.headline) 32 33 ForEach(example.shortcutActionsUsed.indices, id: \.self) { index in 34 Text("\(example.shortcutActionsUsed[index])") 35 .font(.subheadline) 36 } 37 } 38 } 39 40 if let url = example.url { 41 Link(destination: url) { 42 Label("Download Example", systemImage: "link") 43 .font(.body) 44 .foregroundColor(.blue) 45 } 46 } 47 48 Spacer() 49 } 50 .padding() 51 } 52 // .navigationTitle(Text(example.title)) 53 // .navigationBarTitleDisplayMode(.inline) 54 } 55} 56// Preview 57 58#Preview { 59 NavigationView { 60 ExampleView( 61 example: Example( 62 title: "Sample Shortcut", 63 icon: "star.fill", 64 description: 65 "This is a sample shortcut that demonstrates how to use various actions together.", 66 shortcutActionsUsed: ["Get Text", "Show Result", "Ask for Input"], 67 url: URL(string: "https://example.com") 68 )) 69 } 70}