All Projects → steipete → SwiftUITouchHandling

steipete / SwiftUITouchHandling

Licence: MIT License
Testing touch handling from embedded SwiftUI views

Programming Languages

swift
15916 projects

SwiftUITouchHandling

This examples features an UIKit view and a SwiftUI view.

The goal is that areas in SwiftUI that don't process touches should forward touches to the underlying UIView.

Currently the area that is wrapped SwiftUI always consumes touches. In UIKIt this can be prevented via setting userInteractionEnabled = false.

In SwiftUI there's

  • .disabled(true)
  • .allowsHitTesting(false)

But neither does block touches. If we set swiftUI.view.isUserInteractionEnabled = false then touches are forwarded, but the whole item isn't participating in touch forwarding.

This means that SwiftUI views that are partially transparent can't easily be mixed with UIKit, as they still block touch handling for whatever they overlay.

Or maybe there's a way?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].