Posts

Post not yet marked as solved
0 Replies
612 Views
I want to have 7 views with same width, fixed spacing between views and everything that fit the superview. That sounds easy. I know the solution without UIStackView. I thought UIStackView could be simplier (I do the job programmatically and not in storyboard). The code below does not do the job? What do I miss ?class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() var horizontalViews:[UIView] = [] // 7 views for the stack for _ in 0...6 { let dayView = UIView(frame: .zero) dayView.backgroundColor = .blue horizontalViews.append(dayView) } let stack = UIStackView(arrangedSubviews: horizontalViews) stack.axis = .vertical stack.distribution = .fillEqually stack.spacing = 10 self.view.addSubview(stack) // the left and right of the stack is stucked to the controller view stack.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true stack.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true // vertical size and position of the stack stack.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true stack.heightAnchor.constraint(equalToConstant: 50).isActive = true } }
Posted
by chepiok.
Last updated
.
Post not yet marked as solved
0 Replies
493 Views
My app is opening a SFSafariViewController (to get Strava API credential). The app is working well when running the simulator but not when running in UITest. The progress bar starts but is stucked at 20%. Problem with xCode 11.3.1.Any idea?
Posted
by chepiok.
Last updated
.
Post not yet marked as solved
0 Replies
400 Views
Is there a type / container in Healkit where I can store my work time?
Posted
by chepiok.
Last updated
.
Post not yet marked as solved
2 Replies
804 Views
I want to access the most detailled list of heartrate for a workout (from 5:26PM to 5:58PM). On iOS 13, it sounds easy with the code that print 385 heartrates:if #available(iOS 13.0, *) { var index = 1 let quantityType = HKQuantityType.quantityType(forIdentifier: .heartRate)! let predicate = HKQuery.predicateForSamples(withStart: self.workout.startDate, end: self.workout.endDate, options: [.strictStartDate]) let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute()) let query2 = HKQuantitySeriesSampleQuery(quantityType: quantityType, predicate: predicate) { (query, quantity, dateInterval, sample, done, error) in let rate = quantity!.doubleValue(for: heartRateUnit) print("#\(index) \(rate)") index += 1 } HealthKitManager.shared.healthStore.execute(query2) }But on iOS 12 and lower, with the followig code, I've got only 4 samples :2019-02-06 4:26:32 PM +0000 to 2019-02-06 4:26:32 PM +0000 : 138.039142709874032019-02-06 4:36:27 PM +0000 to 2019-02-06 4:36:27 PM +0000 : 168.304179434091822019-02-06 4:46:33 PM +0000 to 2019-02-06 4:46:33 PM +0000 : 177.633914397371142019-02-06 4:56:25 PM +0000 to 2019-02-06 4:56:25 PM +0000 : 167.2611138237847let heartRateQuery = HKSampleQuery( sampleType: HKQuantityType.quantityType(forIdentifier: .heartRate)!, predicate: HKQuery.predicateForSamples(withStart: startDate, end: endDate, options: [.strictStartDate]), limit: HKObjectQueryNoLimit, sortDescriptors: [ NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: true) ]) { (_: HKSampleQuery, results: [HKSample]?, error: Error?) in let heartRateUnit = HKUnit.count().unitDivided(by: HKUnit.minute()) for result in results! { if let sample:HKQuantitySample = result as? HKQuantitySample { let rate = sample.quantity.doubleValue(for: heartRateUnit) print("\(sample.startDate) to \(sample.startDate) : \(rate)") } }How can I get more samples with iOS < 13 ? What do I miss ?
Posted
by chepiok.
Last updated
.
Post not yet marked as solved
2 Replies
1.5k Views
I have a project with 3 localizations. Since something I haven't noticed, when I do "Editor" > "Export for Localization" the xCode (version 10.2.1) is crashing. I've tried to remove all then localized string files. I've try to export only one language. But it does not fix anything. I'm stuck and I don't want to recreate my project/workspace from scratch.Any idea ?
Posted
by chepiok.
Last updated
.