Post

Replies

Boosts

Views

Activity

Reply to Struggling with async/await: Fetching an image off the main thread
Hey Quinn, @DTS Engineer My bad—initially, I wrote the entire code in the view controller to simplify things (yes, I know, Massive View Controller is not a great practice! LOL). I’ve now restructured the code using a simple VIPER architecture. The Actual Goal: I want to fetch data from a server off the main thread, including any data conversion needed for the UI, and then update the UI before and after the fetch. How I Structured It: • The dataTask is triggered inside the interactor’s async fetchListData() function. • In the presenter (which is a class, not an actor), I call fetchListData() using Task. However, since Task doesn’t inherit an actor context, after an await suspension point, it might resume on a different thread. To handle this, I annotated my presenter method with @MainActor to ensure UI updates happen on the main thread. My Questions: Is using @MainActor in the Task the best practice? Or should I make my entire presenter a MainActor? If I use @MainActor in the presenter, will the interactor’s fetchListData() always be executed off the main thread? I don’t want to overload the main thread with network calls or data conversion. Is there a way to ensure that the interactor always returns values on the main thread so that I don’t need to rely on @MainActor annotations in the presenter? Git repo : https://github.com/praveeniroh/AsynAwaitTest
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’24
Reply to Exploring VoiceOver Accessibility for UITableView
@Frameworks Engineer To minimize swipes, I wrapped all elements into a single accessibility element in UITableViewCell and used UIAccessibilityCustomAction to trigger the button’s action.However, the issue arises when this button interaction needs to display a menu. Since the menu cannot be triggered programmatically, how can I achieve this ? Some articles mention that wrapping all visible elements into a single accessibility element is not a good practice. This is because VoiceOver users are not always completely blind, many have partial vision and may try to focus on specific elements individually. If everything is grouped into one element, it can make navigation feel restrictive.I’d love to hear your thoughts on this ,what’s the best approach to balance accessibility and usability in such cases?
Mar ’25
Reply to How to Receive Callbacks for UIAccessibilityAction Methods Like accessibilityPerformMagicTap()?
@Frameworks Engineer Settings > Accessibility > VoiceOver > Commands > Touch Gestures > Magic Tap The default two-finger double tap is assigned to the Magic Tap gesture, and it works as expected in first-party apps like the Clock and Podcasts apps. However, it doesn’t seem to work in my app. Below, I’ve attached a sample code for reference. Strangely, when I perform the Magic Tap in my app, it starts playing a podcast instead. import UIKit class SecondaryVC : UIViewController{ private var actionButton : UIButton = { let button = UIButton(type: .system) button.backgroundColor = .systemGreen button.setTitle("Add", for: .normal) button.layer.cornerRadius = 8 return button }() init(){ super.init(nibName: nil, bundle: nil) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad(){ super.viewDidLoad() view.backgroundColor = .systemTeal addSubViews() } override class func accessibilityPerformMagicTap() -> Bool { print(">>>> SecondaryVC accessibilityPerformMagicTap") return true } override class func accessibilityPerformEscape() -> Bool { print(">>>> secodaryVC EscapeAction") return true } override class func accessibilityDecrement() { print(">>>> accessibilityDecrement") } override class func accessibilityIncrement() { print(">>>> accessibilityIncrement") } private func addSubViews(){ view.addSubview(actionButton) actionButton.translatesAutoresizingMaskIntoConstraints = false actionButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor,constant: 16).isActive = true actionButton.leadingAnchor.constraint(equalTo: view.leadingAnchor,constant: 16).isActive = true actionButton.trailingAnchor.constraint(equalTo: view.trailingAnchor,constant: -16).isActive = true } }
Mar ’25
Reply to Best Way to Navigate to the Top Element Using VoiceOver
@Frameworks Engineer On iPhone/iPad, the VoiceOver cursor ficus the item under the my finger when performing a press and hold. However, on Mac, if I’m using only keyboard navigation, how can I achieve the same behavior? Is there an optimized way to navigate directly to the Done button without manually moving through all elements? Any suggestions would be greatly appreciated!
Mar ’25
Reply to The requested URL is not permitted to be downloaded until the application is launched error in background assets
Thanks for the update, My bad. Instead of domain name ,I provided domain name with scheme (https://w0.peakpx.com)
Replies
Boosts
Views
Activity
Jul ’23
Reply to How to show count down timer in live activity?
I tried to observe the Stale state , but for stale state,I got call back only when I opened the app by tapping live activity. Otherwise the stale state change is not observed by activityStateUpdates even after the stale date
Replies
Boosts
Views
Activity
Jul ’23
Reply to Background Asset. Failed because the app and extension do not share any application groups.
Did you add common app group between your main target and background asset target? Kindly check app common group exist in Targets -> -> Signing & Capabilities and Targets -> <AppName (main Target)> -> Signing & Capabilities
Replies
Boosts
Views
Activity
Oct ’23
Reply to iOS 18 - How to change the tint color of elevated tabbar?
@Frameworks Engineer I was able to update the tint color as you mentioned. However, the tint often doesn't update for the selected tab item. This issue seems to persist even in native apps.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to iOS 18 - How to change the tint color of elevated tabbar?
@Frameworks Engineer The provided tint color is not applied to images in UITab, unlike in UITabBarItem. How can this be handled? And is there any workaround to update sidebar's accent color to use tintColor?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to iOS 18: SplitViewController Primary View Controller Title Disappears When Split View Expands
@DTS Engineer Any workaround for this issue
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to iOS 18 - How to change the tint color of elevated tabbar?
@Frameworks Engineer tabBarController:sidebar:updateItem: function is called in a random order after selecting a tab, how can I properly update the tint color for the selected item?(while hardware keyboard is connected and focus changed)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Struggling with async/await: Fetching an image off the main thread
@DTS Engineer My goal isn't just about fetching an image; it's about hitting any API. In the traditional closure-based flow, we manually switch to a background thread to make the API call and then switch back to the main thread to handle the result. I want to achieve the same functionality using structured concurrency,
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Struggling with async/await: Fetching an image off the main thread
Hey Quinn, @DTS Engineer My bad—initially, I wrote the entire code in the view controller to simplify things (yes, I know, Massive View Controller is not a great practice! LOL). I’ve now restructured the code using a simple VIPER architecture. The Actual Goal: I want to fetch data from a server off the main thread, including any data conversion needed for the UI, and then update the UI before and after the fetch. How I Structured It: • The dataTask is triggered inside the interactor’s async fetchListData() function. • In the presenter (which is a class, not an actor), I call fetchListData() using Task. However, since Task doesn’t inherit an actor context, after an await suspension point, it might resume on a different thread. To handle this, I annotated my presenter method with @MainActor to ensure UI updates happen on the main thread. My Questions: Is using @MainActor in the Task the best practice? Or should I make my entire presenter a MainActor? If I use @MainActor in the presenter, will the interactor’s fetchListData() always be executed off the main thread? I don’t want to overload the main thread with network calls or data conversion. Is there a way to ensure that the interactor always returns values on the main thread so that I don’t need to rely on @MainActor annotations in the presenter? Git repo : https://github.com/praveeniroh/AsynAwaitTest
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Exploring VoiceOver Accessibility for UITableView
@Frameworks Engineer To minimize swipes, I wrapped all elements into a single accessibility element in UITableViewCell and used UIAccessibilityCustomAction to trigger the button’s action.However, the issue arises when this button interaction needs to display a menu. Since the menu cannot be triggered programmatically, how can I achieve this ? Some articles mention that wrapping all visible elements into a single accessibility element is not a good practice. This is because VoiceOver users are not always completely blind, many have partial vision and may try to focus on specific elements individually. If everything is grouped into one element, it can make navigation feel restrictive.I’d love to hear your thoughts on this ,what’s the best approach to balance accessibility and usability in such cases?
Replies
Boosts
Views
Activity
Mar ’25
Reply to How to Receive Callbacks for UIAccessibilityAction Methods Like accessibilityPerformMagicTap()?
@Frameworks Engineer Settings > Accessibility > VoiceOver > Commands > Touch Gestures > Magic Tap The default two-finger double tap is assigned to the Magic Tap gesture, and it works as expected in first-party apps like the Clock and Podcasts apps. However, it doesn’t seem to work in my app. Below, I’ve attached a sample code for reference. Strangely, when I perform the Magic Tap in my app, it starts playing a podcast instead. import UIKit class SecondaryVC : UIViewController{ private var actionButton : UIButton = { let button = UIButton(type: .system) button.backgroundColor = .systemGreen button.setTitle("Add", for: .normal) button.layer.cornerRadius = 8 return button }() init(){ super.init(nibName: nil, bundle: nil) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad(){ super.viewDidLoad() view.backgroundColor = .systemTeal addSubViews() } override class func accessibilityPerformMagicTap() -> Bool { print(">>>> SecondaryVC accessibilityPerformMagicTap") return true } override class func accessibilityPerformEscape() -> Bool { print(">>>> secodaryVC EscapeAction") return true } override class func accessibilityDecrement() { print(">>>> accessibilityDecrement") } override class func accessibilityIncrement() { print(">>>> accessibilityIncrement") } private func addSubViews(){ view.addSubview(actionButton) actionButton.translatesAutoresizingMaskIntoConstraints = false actionButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor,constant: 16).isActive = true actionButton.leadingAnchor.constraint(equalTo: view.leadingAnchor,constant: 16).isActive = true actionButton.trailingAnchor.constraint(equalTo: view.trailingAnchor,constant: -16).isActive = true } }
Replies
Boosts
Views
Activity
Mar ’25
Reply to How to Receive Callbacks for UIAccessibilityAction Methods Like accessibilityPerformMagicTap()?
@Frameworks Engineer any update on this?
Replies
Boosts
Views
Activity
Mar ’25
Reply to Best Way to Navigate to the Top Element Using VoiceOver
@Frameworks Engineer On iPhone/iPad, the VoiceOver cursor ficus the item under the my finger when performing a press and hold. However, on Mac, if I’m using only keyboard navigation, how can I achieve the same behavior? Is there an optimized way to navigate directly to the Done button without manually moving through all elements? Any suggestions would be greatly appreciated!
Replies
Boosts
Views
Activity
Mar ’25
Reply to accessibilityElements excludes the unlisted subviews – How to Fix?
@Frameworks Engineer Thank you! I’ve already implemented a solution similar to what you suggested. I filtered the desired elements from the existing array, reordered them, and then appended them to the default order elements.
Replies
Boosts
Views
Activity
Mar ’25
Reply to VoiceOver Text Recognition Announcing Hidden Labels
@Frameworks Engineer Bug id FB17062976
Replies
Boosts
Views
Activity
Apr ’25