Skip to content

Improve interoperability with native UI frameworks #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stackotter
Copy link
Owner

This PR introduces various APIs related to improving interoperability between SwiftCrossUI view code and native UI frameworks. This includes:

  • Making it easier to make platform-specific modifications to the native widgets behind SwiftCrossUI views via the inspect family of modifiers
    • This allows people to work around missing SwiftCrossUI features and to access niche platform-specific APIs that we don't plan on wrapping
  • Enabling the hosting of SwiftCrossUI views in native apps via the FooHostingView family of types
  • Enabling the hosting of native views in SwiftCrossUI apps via the FooRepresentable family of types
    • (SwiftCrossUI already NSViewRepresentable, UIViewRepresentable and UIViewControllerRepresentable, but we still need to introduce similar APIs for the non-Apple backends)

So far I've completed the inspect family of view modifiers (which are housed in each backend), and introduced an AdvancedCustomizationExample app to showcase these new advanced customization APIs.

@stackotter stackotter force-pushed the backend_interop branch 3 times, most recently from 40ce4d3 to 2407a98 Compare June 26, 2025 07:41
These changes make platform-specific native customizations significantly
easier to perform. Hopefully this will make SwiftCrossUI significantly
more viable for actual production apps that often just need to get
things working even if there's not a nice neat first party API for it
yet.

Inspiration was taken from swiftui-introspect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant