I discovered that my iMac and iPad are on different networks. My home WiFi router has the usual main network/guest network separation, where the guest network can only to to the Internet. When I moved my iPad to my main network the "Connect via network" workflow worked--I now see the icon next to my iPad name. And, of course, I was able to launch my app wirelessly.
Something minor to check.
Post
Replies
Boosts
Views
Activity
Still see this on Xcode 15.3 with imports of a local package. After commenting out the dependencies (both in the View code and the #preview) and removing the #import the #preview starts working again. For now, my only alternative is to put the local package code into the main project. Hopefully a solution will be available before I use the package in another app.
I'm using Version 15.3 (15E204a) and still seeing this problem. For example, a simple extension I use for quick View debugging:
extension View {
func redBorder() -> some View { return self.border(Color.red, width: width) }
}
I also found that using UserDefaults.standard did not work. What helped was creating an instance of UserDefaults in both my Watch app and its complication. These two definitions use the group name from the Apps Group setting.
Each have a UserSettings.swift file (name not important) where I keep data that needs to be shared.
class UserSettings: ObservableObject {
// Define the UserDefaults instance that gets shared.
// If it can't then at least return UserDefaults.standard.
// Lets the code work when you're not focusing on complications yet.
let userDefaults: UserDefaults = {
if let defaults = UserDefaults(suiteName: "group.MyGroupName") {
return defaults
}
return UserDefaults.standard
}()
var someData: Int {
didSet {
userDefaults.set(someData, forKey: "someDatakey")
}
}
}
FYI, you can also add @Published to the individual variable definitions (e.g., someData) if your app needs to respond to changes.
(I'm also trying to figure out how to have the complication automatically update when the app changes someData.)