Updating an app to use strict concurrency is not compiling in Swift 6 with strict concurrency enabled. I am getting the following error in Xcode Version 16.0 (16A242d).
private func queryHealthKit() async throws -> (
[HKSample]?, [HKDeletedObject]?, HKQueryAnchor?
) {
try await withCheckedThrowingContinuation { continuation in
// Create a predicate that returns only samples created within the last 24 hours.
let endDate = Date()
let startDate = endDate.addingTimeInterval(-24.0 * 60.0 * 60.0)
let datePredicate = HKQuery.predicateForSamples(
withStart: startDate, end: endDate, options: [.strictStartDate, .strictEndDate])
// Create the query.
let query = HKAnchoredObjectQuery(
type: caffeineType,
predicate: datePredicate,
anchor: anchor,
limit: HKObjectQueryNoLimit
) { (_, samples, deletedSamples, newAnchor, error) in
// When the query ends, check for errors.
if let error {
continuation.resume(throwing: error)
} else {
continuation.resume(returning: (samples, deletedSamples, newAnchor))
}
}
store.execute(query)
}
}
The error is on
** continuation.resume(returning: (samples, deletedSamples, newAnchor))
**
and the error is
Task-isolated value of type '([HKSample]?, [HKDeletedObject]?, HKQueryAnchor?)' passed as a strongly transferred parameter; later accesses could race. How to solve this error?
Post
Replies
Boosts
Views
Activity
We are getting following error in xcode cloud
"The step invocation hit a user timeout. The xcodebuild archive invocation timed out. No activity has been detected on stdout, stderr or the result bundle in 30 minutes"
We are using following env to create a build.
Xcode: 14.2
Macos: Ventura 13.2.1
We didn't face any issue in Ventura 13.2.0 and we are seeing this issue in our first build using ventura 13.2.1.
The difference I see between successful and failure build, I don't see
"Discovering Swift tasks after 'Compiling { list of swift file " in a failed build. I see compiling { list of swift file } and end of the compilation, the build is failing.
Raj was mentioning about this inert modifier for writing conditional writing environment. Any help on this?
I tried to replicate the code but I am not able to traverse the my data.
import SwiftUI
struct ContentView: View {
let testData: [Data]
var body: some View {
List(testData, children: \.children) { value in
Text(value.values)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(testData: testData)
}
}
let testData = [Data(), Data()]
struct Data: Identifiable {
let id = UUID()
let values: [String] = ["One", "Two", "Three"]
}
I am getting error "Value of type 'Data' has no member 'children'" . I even tried values instead of children but I am getting "Key path value type '[String]' cannot be converted to contextual type '[Data]?'"
Please let me know how to use \.children and outline group.