HI,
I have an issue displaying SwiftUI previews with Xcode 14.
My project has iOS and an watchOS Target. It also includes a lot of SPM, most of them only used by the PhoneApp. The project build successfully for both iOS and watchOS.
I can see that when building the watch target, only SPM that are included in this target are build for for watchOS
The issue is when I try to build a swiftUI preview of the watch target. In this case I can see on the build for Preview log that Xcode try to build ALL spm defined in the Xcode project, including the one that are not used by the watch Target,
As a lot if spm are for iOS only, and doesn't build for watchOS, the build for preview fails, and I'm unable to preview my swiftUI views on the AppeWatch.
Note that my project is working fine on Xcode 13.
This issue is easy to reproduce in any Xcode projects containing a iOS and watchOS target by adding a SPM that is only for iOS.
Any workaround to fix this issue ?
Post
Replies
Boosts
Views
Activity
Hi,
I have a Xcode project with a iOS and watchOS target.
I’m using protobuf to encode messages, and I tried to put all the code related to this on a SPM shared between the iOS and watchOS target
Here is my Package.swift files:
import PackageDescription
let package = Package(
name: "Protobuf",
products: [
.library(name: "Protobuf", targets: ["Protobuf"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-protobuf", from: "1.0.0"),
],
targets: [
.target(
name: "Protobuf",
dependencies: [.product(name: "SwiftProtobuf", package: "swift-protobuf")],
plugins: [
.plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
])
]
)
I've added this package to my Xcode project, and added the Protobuf library to the iOS target, and the project compile fine, but when I also add the Protobuf library to the watchOS target, Xcode give me a compile error telling that multiple commands produce the swift file generated from the .proto file.
Am I doing something wrong or is this a Xcode issue ?
Hi,
My app allows to connect to a bluetooth device. If the user has multiple devices he can connect all of them simultaneously, the app UI is presenting a list of all paired device.
If the user open the phone bluetooth settings and forget one of the paired device, I would like to also remove it from the list of paired devices in displayed in my application.
I was expecting CBCentralManager.retrievePeripherals(withIdentifiers:) to return nil if the device has been removed in the bluetooth setting but this function still return a device.
Is there another solution to do that ?
Thanks
My matter accessory define an endpoint of type light, with a custom cluster.
if I connect my accessory using Home app, I'm I supposed to find HMService/HMCharacteristic corresponding to my custom matter cluster?
Is there any requirement on the custom cluster to have it visible in HomeKit ?
Thanks.