Post

Replies

Boosts

Views

Activity

HKStatisticsCollectionQueryDescriptor document example is not executed.
let stepType = HKQuantityType(.stepCount)         let stepsThisWeek = HKSamplePredicate.quantitySample(type: stepType, predicate: thisWeek)         let yesterday = calendar.date(byAdding: .day, value: -1, to: calendar.startOfDay(for: now))         let every5 = DateComponents(minute:5)         let healthTypes = Set([             HKCategoryType.categoryType(forIdentifier: .handwashingEvent)!         ])         let sumOfStepsQuery = HKStatisticsCollectionQueryDescriptor(             predicate: stepsThisWeek,             options: .cumulativeSum,             anchorDate: endDate,             intervalComponents: every5)         do {             let updateQueue = sumOfStepsQuery.results(for: store)             // Wait for the initial results and updates.             updateQueue = Task {                 for try await results in updateQueue {                     // Use the statistics collection here.                 }             }                      } catch {             //handle error             print(error)         }
0
0
1k
Jun ’22
RealityView in swiftUI look weird on vision pro
it is way above of control panel.... the code I show usdz modeling is as below `RealityView{ content in let entity = try! await Entity(named: "idle") entity.setScale([0.15,0.15,0.15], relativeTo: entity) // Enable interactions on the entity. entity.components.set(InputTargetComponent()) entity.components.set(CollisionComponent(shapes: [.generateBox(size: [2,2,2])] ) ) content.add(entity ) }`
0
0
538
Feb ’24