Something went wrong. Try again.
Something went wrong. Try again.
2.1 kB · 70 lines
Swift
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071//// ExampleView.swift// shortcut//// Created by Bailey Townsend on 7/8/25.//
import SwiftUI
struct ExampleView: View { let example: Example
var body: some View { ScrollView { VStack(alignment: .leading, spacing: 16) { HStack(spacing: 12) { Image(systemName: example.icon) .font(.system(size: 40)) .foregroundColor(.accentColor) Text(example.title) .font(.title) .fontWeight(.bold) }
Text(example.description) .font(.body)
if !example.shortcutActionsUsed.isEmpty { VStack(alignment: .leading, spacing: 8) { Text("Used Shortcut Actions") .font(.headline)
ForEach(example.shortcutActionsUsed.indices, id: \.self) { index in Text("• \(example.shortcutActionsUsed[index])") .font(.subheadline) } } }
if let url = example.url { Link(destination: url) { Label("Download Example", systemImage: "link") .font(.body) .foregroundColor(.blue) } }
Spacer() } .padding() } // .navigationTitle(Text(example.title)) // .navigationBarTitleDisplayMode(.inline) }}// Preview
#Preview { NavigationView { ExampleView( example: Example( title: "Sample Shortcut", icon: "star.fill", description: "This is a sample shortcut that demonstrates how to use various actions together.", shortcutActionsUsed: ["Get Text", "Show Result", "Ask for Input"], url: URL(string: "https://example.com") )) }}