Hi, I want to enable swipeActions for some rows of a List while other rows do not have this action.
Here is an example:
List {
ForEach(1..<100) { i in
Text("\(i)")
.swipeActions(edge: .leading) {
Button {
total += i
} label: {
Label("Add \(i)", systemImage: "plus.circle")
}
.tint(.indigo)
}
.swipeActions(edge: .trailing) {
Button {
total -= i
} label: {
Label("Subtract \(i)", systemImage: "minus.circle")
}
}
}
}
What would be the best approach to disable the swipeActions for let say the 50 row?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
With iOS 17 creation of HKWorkout is deprecated via its init functions and the recommendation is to use HKWorkoutBuilder. If you try to init HKWorkout like you would pre iOS 17 you get this warning of deprecation:
The problem is that I am creating this HKWorkout object inside unit tests in order to test a service that works with such objects. And HKWorkoutBuilder requires a HKHealthStore which itself requires to be authenticated to be able to create HKWorkoutActivity instances, like it would be when an app is running. But since the unit tests cannot accept the request on the HKHealthStore I am not sure if using HKWorkoutBuilder inside unit tests is possible.
I've also tried to inherit HKHealthStore and override all of its methods, but still, store requires authorization.
Any ideas on how to proceed with creating HKWorkout for unit test purposes?
Hi, with iOS 17 creation of HKWorkout is deprecated via its init functions and the recommendation is to use HKWorkoutBuilder:
The problem is that I am creating this HKWorkout object inside unit tests in order to test a service that works with such objects. And HKWorkoutBuilder requires a HKHealthStore which itself requires to be authenticated to be able to create HKWorkoutActivity instances, like it would be when an app is running. But since the unit tests cannot accept the request on the HKHealthStore I am not sure if using HKWorkoutBuilder inside unit tests is possible.
Any ideas on how to proceed with creating HKWorkout for unit test purposes?
Hi,
The UIApplication.shared.applicationIconBadgeNumber has been deprecated in iOS 17 and the recommendation is to use setBadgeCount(_:withCompletionHandler:) but what if I only want to read this number and not change it?
How would one only read this number in iOS 17?