Use atproto actions with ease in iOS shortcuts
at main 1.9 kB view raw
1// 2// UTCIntent.swift 3// shortcut 4// 5// Created by Bailey Townsend on 6/29/25. 6// 7 8import ATProtoKit 9import AppIntents 10import SwiftData 11 12//struct UTCIntent: AppIntent { 13// 14// @Parameter( 15// title: "Date Source", 16// description: "Choose whether to use the current datetime or specify a date", 17// ) 18// var dateSource: DateSource 19// 20// @Parameter( 21// title: "DateTime", 22// description: 23// "Creates a UTC Timestamp from the given datetime, if one is not given uses the current devices time to create the timestamp. Make sure you use \"Date Format: Long\" and \"Time Format Long\"" 24// ) 25// var date: Date? 26// 27// static let title: LocalizedStringResource = 28// "Create a UTC timestamp" 29// 30// static let description: IntentDescription = IntentDescription( 31// "Creates a UTC ISO8601 timestamp from the given DateTime, if one is not given uses the current DateTime", 32// resultValueName: "UTC Timestamp" 33// ) 34// 35// static var parameterSummary: some ParameterSummary { 36// Switch(\.$dateSource) { 37// Case(.currentTime) { 38// Summary("Create a UTC timestamp using \(\.$dateSource)") 39// 40// } 41// Case(.specificDate) { 42// Summary("Create a UTC timestamp from a \(\.$dateSource) using \(\.$date)") 43// } 44// DefaultCase { 45// Summary("Create a UTC timestamp using \(\.$dateSource)") 46// } 47// } 48// 49// } 50// func perform() async throws -> some ReturnsValue<String> { 51// 52// let formatter = ISO8601DateFormatter() 53// formatter.timeZone = TimeZone(abbreviation: "UTC") 54// if let date = self.date { 55// return .result(value: formatter.string(from: date)) 56// } 57// let currentDate = Date() 58// return .result(value: formatter.string(from: currentDate)) 59// 60// } 61// 62//}