Post

Replies

Boosts

Views

Activity

Disable "swipeActions" on only a specific row in a List
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?
1
0
1.1k
Nov ’23
How to use `HKWorkoutBuilder` inside unit tests on iOS 17 and above
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?
0
1
725
Nov ’23
iOS 17: How to use `HKWorkoutBuilder` inside unit tests
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?
0
2
789
Oct ’23
Disable "swipeActions" on only a specific row in a List
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?
Replies
1
Boosts
0
Views
1.1k
Activity
Nov ’23
How to use `HKWorkoutBuilder` inside unit tests on iOS 17 and above
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?
Replies
0
Boosts
1
Views
725
Activity
Nov ’23
iOS 17: How to use `HKWorkoutBuilder` inside unit tests
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?
Replies
0
Boosts
2
Views
789
Activity
Oct ’23
"UIApplication.shared.applicationIconBadgeNumber" deprecated, how to get the "badge icon number" in iOS 17?
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?
Replies
2
Boosts
1
Views
1.7k
Activity
Oct ’23