Post

Replies

Boosts

Views

Activity

Reply to I need to read multiple Queries of HKStatisticsCollectionQuery Like StepCount and Swimming Stroke
I have solved the problem by creating the two separate func for two separate queries like   func stepCount(completion: @escaping (HKStatisticsCollection?)-> Void){         let stepCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)!         let startDate = Calendar.current.date(byAdding: .day,value: -7, to: Date())         let anchorDate = Date.monday12AM()         let daily = DateComponents(day : 1)         let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)         query = HKStatisticsCollectionQuery(quantityType: stepCount, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily)   query!.initialResultsHandler = { query, statisticsCollection, error in             completion(statisticsCollection)         }         if let healthStore = healthStore,let query = self.query{             healthStore.execute(query)         }     }     func swimmingStroke(completion : @escaping (HKStatisticsCollection?)-> Void){         let swimmmingStrokeCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.swimmingStrokeCount)!         let startDate = Calendar.current.date(byAdding: .day,value: -7, to: Date())         let anchorDate = Date.monday12AM()         let daily = DateComponents(day : 1)         let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)         query1 = HKStatisticsCollectionQuery(quantityType: swimmmingStrokeCount, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily)         query1!.initialResultsHandler = { query1, statisticsCollection1, error in             completion(statisticsCollection1)         }         if let healthStore1 = healthStore,let query1 = self.query1{             healthStore1.execute(query1)         }     } and updating the UI by if let healthStore1 = healthStore {                 healthStore1.authorization { success in                     if success{                         healthStore1.swimmingStroke{ statisticsCollection1  in                             if let statisticsCollection1 = statisticsCollection1{                                 print(statisticsCollection1)                                 UpdateUIFromStatistics1(statisticsCollection1)                             }else{                                 print("no statistics Collection Data1")                             }                         }                     }                 }             }             if let healthStore = healthStore {                 healthStore.authorization { success in                     if success{                         healthStore.readData{ statisticsCollection  in                             if let statisticsCollection = statisticsCollection{                                 print(statisticsCollection)                                 UpdateUIFromStatistics(statisticsCollection)                             }else{                                 print("no statistics Collection Data")                             }                         }                     }                 }             }
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’23
Reply to I need to delete the spaces between two text()
Thank You
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to I need to read multiple Queries of HKStatisticsCollectionQuery Like StepCount and Swimming Stroke
I have solved the problem by creating the two separate func for two separate queries like   func stepCount(completion: @escaping (HKStatisticsCollection?)-> Void){         let stepCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.stepCount)!         let startDate = Calendar.current.date(byAdding: .day,value: -7, to: Date())         let anchorDate = Date.monday12AM()         let daily = DateComponents(day : 1)         let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)         query = HKStatisticsCollectionQuery(quantityType: stepCount, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily)   query!.initialResultsHandler = { query, statisticsCollection, error in             completion(statisticsCollection)         }         if let healthStore = healthStore,let query = self.query{             healthStore.execute(query)         }     }     func swimmingStroke(completion : @escaping (HKStatisticsCollection?)-> Void){         let swimmmingStrokeCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.swimmingStrokeCount)!         let startDate = Calendar.current.date(byAdding: .day,value: -7, to: Date())         let anchorDate = Date.monday12AM()         let daily = DateComponents(day : 1)         let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)         query1 = HKStatisticsCollectionQuery(quantityType: swimmmingStrokeCount, quantitySamplePredicate: predicate,options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: daily)         query1!.initialResultsHandler = { query1, statisticsCollection1, error in             completion(statisticsCollection1)         }         if let healthStore1 = healthStore,let query1 = self.query1{             healthStore1.execute(query1)         }     } and updating the UI by if let healthStore1 = healthStore {                 healthStore1.authorization { success in                     if success{                         healthStore1.swimmingStroke{ statisticsCollection1  in                             if let statisticsCollection1 = statisticsCollection1{                                 print(statisticsCollection1)                                 UpdateUIFromStatistics1(statisticsCollection1)                             }else{                                 print("no statistics Collection Data1")                             }                         }                     }                 }             }             if let healthStore = healthStore {                 healthStore.authorization { success in                     if success{                         healthStore.readData{ statisticsCollection  in                             if let statisticsCollection = statisticsCollection{                                 print(statisticsCollection)                                 UpdateUIFromStatistics(statisticsCollection)                             }else{                                 print("no statistics Collection Data")                             }                         }                     }                 }             }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to CoreML Image Size Identification
Thank you for your valuable replay needed a lot
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’23
Reply to Sending a Confirmation Mail to Customers when a button is clicked
Im new to programming my programming is Swift so what you are saying is difficult to understand also im not sure about php is there any other solution or it is easy to do on php using own servers? if yes can you elaborate Thank you
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’23