SwiftUI Bug (or Feature?) in iOS 18

I wanted to share a quick tip for anyone encountering the same issue I faced while working on my latest SwiftUI project.

Here’s the problem: I had a simple SwiftUI view with a List and a custom Button in a HStack. Here’s what the code looked like:


When running on iOS 18, the Button stopped recognizing tap gestures. After some digging, I found out that it’s due to a new behavior in SwiftUI: parent views can block child view gestures.

You can work around this by explicitly assigning a higher priority to the tap gesture on the view.



Jürgen Schuck

Projektmanager, Coder und Writer | #lachen #wandern #mopedfahren

1 个月

thx for sharing. had a similiar problem with ios18 probably belonging to the same category. my parent view uses double-tap with a child using single. starting with 18 responsiveness went bad: had to tap the child rather long. discussion attached led to recent changes made by apple (well-thought, of course...). unbreakable optimistic, i hope on a fix. until then, i changed the parent from double- to long-tap... https://developer.apple.com/forums/thread/765559?answerId=809164022#809164022

赞
回复
Myroslav Sokolov ??

Full stack developer | 7 years+ | React, RxJs, Typescript, Nest.js, Node.js, .Net, SQL

4 个月

Good to know.

Natan Mohart

Tech Entrepreneur | Team Lead & Software Engineer | Author & Speaker | Follow for daily posts about Mindset, Personal Growth, and Leadership

4 个月

Love this

Ilya Savelev

Data Engineer | 5+ years | PepsiCo | Databricks, Apache Spark, Microsoft Azure

4 个月

Very valuable info!

要查看或添加评论,请登录

? Dima Bronnikov的更多文章

  • Common patterns for solving Linked List problems.

    Common patterns for solving Linked List problems.

    1. The Dummy Node Trick The "dummy node" is a placeholder node used to simplify edge cases in linked list operations.

    2 条评论
  • Avoiding Memory Leaks with Async Sequences in Swift

    Avoiding Memory Leaks with Async Sequences in Swift

    Recently, I encountered an interesting issue in a project involving memory management with async sequences. Here’s a…

    7 条评论

社区洞察

其他会员也浏览了