Post

Replies

Boosts

Views

Activity

Reply to Failed to determine hittability of an element
Still a problem 3 years later on Xcode 13.3.1 13E500a. A workaround we are using is to wait for other elements to disappear or appear before waiting for the button to be hittable. Such as Waiting for a UIActivityIndicator to not exist Waiting for a navigation bar to exist with certain text Wait for a collection view to exist with a cell count Seems to give the XCUIApplication more time to avoid the error
May ’22
Reply to How to present a minutes countdown in a Live Activity?
Hey it took me days to figure it out, but the way is to use a custom date formatter. See example code below import SwiftUI struct ContentView: View { var body: some View { VStack { Text(date, formatter: formatter) } .padding() } var date: Date { Date().addingTimeInterval(20*60) } var formatter: RelativeMinutesDateFormatter { RelativeMinutesDateFormatter() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } class RelativeMinutesDateFormatter : Formatter { open override func string(for obj: Any?) -> String? { guard let date = obj as? Date else { return nil } let minutes = Int(date.timeIntervalSince(.now) / 60) return "\(minutes)m" } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Reply to Failed to determine hittability of an element
Still a problem 3 years later on Xcode 13.3.1 13E500a. A workaround we are using is to wait for other elements to disappear or appear before waiting for the button to be hittable. Such as Waiting for a UIActivityIndicator to not exist Waiting for a navigation bar to exist with certain text Wait for a collection view to exist with a cell count Seems to give the XCUIApplication more time to avoid the error
Replies
Boosts
Views
Activity
May ’22
Reply to Any xcode code samples for live activity on ios16?
Xcode 14.1 beta 2 working code sample https://github.com/mszpro/iOS16.1-LiveActivities-DynamicIsland-Demo
Replies
Boosts
Views
Activity
Sep ’22
Reply to How to present a minutes countdown in a Live Activity?
Hey it took me days to figure it out, but the way is to use a custom date formatter. See example code below import SwiftUI struct ContentView: View { var body: some View { VStack { Text(date, formatter: formatter) } .padding() } var date: Date { Date().addingTimeInterval(20*60) } var formatter: RelativeMinutesDateFormatter { RelativeMinutesDateFormatter() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } class RelativeMinutesDateFormatter : Formatter { open override func string(for obj: Any?) -> String? { guard let date = obj as? Date else { return nil } let minutes = Int(date.timeIntervalSince(.now) / 60) return "\(minutes)m" } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’23