I'm trying to run(debug) an Xcode watch app project on my watch. My phone is connected to my computer via USB cable, my watch is paired to my phone. When I open Xcode and then open "Devices and simulators", I can see my phone properly connected. But these errors show up for my watch........
Apple Watch may need to be unlocked to recover from previously reported preparation errors
Ensure the device is unlocked and associated with the same local area network as this Mac.
A connection to this device could not be established.
Timed out while attempting to establish tunnel using negotiated network parameters.
I have booted computer, phone and watch. I have turned wifi off and on, on all 3 devices. I have turned developer mode on the watch off and then back on again.
Anyone have any ideas how to fix this?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
When my AppShortcut phrase is:
"Go (.$direction) with (.applicationName)"
Then everything works correctly, the AppIntent correctly receives the parameter. But when my phrase is:
"What is my game (.$direction) with (.applicationName)"
The an alert dialog pops up saying:
"Hey siri what is my game tomorrow with {app name}
Do you want me to use ChatGPT to answer that?"
The phrase is obviously heard correctly, and it's exactly what I've specified in the AppShortcut. Why isn't it being sent to my AppIntent?
import Foundation
import AppIntents
@available(iOS 17.0, *)
enum Direction: String, CaseIterable, AppEnum {
case today, yesterday, tomorrow, next
static var typeDisplayRepresentation: TypeDisplayRepresentation {
TypeDisplayRepresentation(name: "Direction")
}
static var caseDisplayRepresentations: [Direction: DisplayRepresentation] = [
.today: DisplayRepresentation(title: "today", synonyms: []),
.yesterday: DisplayRepresentation(title: "yesterday", synonyms: []),
.tomorrow: DisplayRepresentation(title: "tomorrow", synonyms: []),
.next: DisplayRepresentation(title: "next", synonyms: [])
]
}
@available(iOS 17.0, *)
struct MoveItemIntent: AppIntent {
static var title: LocalizedStringResource = "Move Item"
@Parameter(title: "Direction")
var direction: Direction
func perform() async throws -> some IntentResult {
// Logic to move item in the specified direction
print("Moving item \(direction)")
return .result()
}
}
@available(iOS 17.0, *)
final class MyShortcuts: AppShortcutsProvider {
static let shortcutTileColor = ShortcutTileColor.navy
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: MoveItemIntent()
, phrases: [
"Go \(\.$direction) with \(.applicationName)"
// "What is my game \(\.$direction) with \(.applicationName)"
]
, shortTitle: "Test of direction parameter"
, systemImageName: "soccerball"
)
}
}
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
SiriKit
App Intents
A user can use Siri to display a list of items from my app. When the user touches on an item to open the app - how do I pass that item to the main app so I know which item detail page to display? This is a SwiftUI app.
SwiftUI, using LPLinkView through UIViewRepresentable. Default behavior is a long press brings up a context menu and a popover to preview content. I want to replace that default long press behavior with my own custom screen. Adding a UILongPressGestureRecognizer didn't work.
Thanks!
Simple master screen with list, NavigationLink to editable detail view.
I want edits on the detail screen to update to the master list "cars" variable and the list UI.
On the detail view, if I edit one field and exit the field, the value reverts to the original value. Why?
If I edit one field, don't change focus and hit the back button. The master list updates. This is what I want, but I can only update 1 field because of problem #1. Should be able to edit all the fields.
If I implement the == func in the Car struct, then no updates get saved. Why?
struct Car: Hashable, Equatable {
var id: UUID = UUID()
var make: String
var model: String
var year: Int
// static func == (lhs: Car, rhs: Car) -> Bool {
// return lhs.id == rhs.id
// }
}
struct ContentView: View {
@State private var cars: [Car]
init() {
cars = [
Car(make: "Toyota", model: "Camry", year: 2020),
Car(make: "Honda", model: "Civic", year: 2021),
Car(make: "Ford", model: "Mustang", year: 2022),
Car(make: "Chevrolet", model: "Malibu", year: 2023),
Car(make: "Nissan", model: "Altima", year: 2024),
Car(make: "Kia", model: "Soul", year: 2025),
Car(make: "Volkswagen", model: "Jetta", year: 2026)
]
}
var body: some View {
NavigationStack {
VStack {
ForEach($cars, id: \.self) { $car in
NavigationLink(destination: CarDetailView(car: $car)){
Text(car.make)
}
}
}
}
}
}
struct CarDetailView: View {
@Binding var car: Car
var body: some View {
Form {
TextField("Make", text: $car.make)
TextField("Model", text: $car.model)
TextField("Year", value: $car.year, format: .number)
}
}
}
Is there any way to change the height of the "day" cells in the UICalendarView? The view is very tall on the screen and I'd like to shorten it so I can put more content below it without using a scroll view.
I'm using SwiftUI with a UICalendarView with UIViewRepresentable. The calendar will have default decorations to indicate a date with events.
Topic:
UI Frameworks
SubTopic:
SwiftUI