swift-cross-ui icon indicating copy to clipboard operation
swift-cross-ui copied to clipboard

Implement a WebView

Open stackotter opened this issue 7 months ago • 2 comments

Web views are used by many applications and are also tricky to do in a cross-platform way. This makes them a perfect candidate for being a first party offering of SwiftCrossUI! Due to being a bit of a "you either need it or you don't" feature and requires additional dependencies on Linux, we probably want to pop this behind a trait once we bump to a Swift version that supports them.

This issue requires:

  • Designing a declarative API for displaying and controlling a web view, likely using bindings for things such as the current URL, and modifiers for controlling settings such as whether JS is enabled etc.
  • Updating the AppBackend protocol with suitable webview-related methods that neatly abstract over all of the common functionality that we want to wrap
  • Updating the underlying backend implementations to implement these new protocol requirements
  • Implementing a WebView struct conforming to View and using the underlying backend to implement the designed API

Underlying technologies:


If you're tackling this issue, I'd recommend settling on an API design before getting started on the implementation and commenting on this issue with some details so that I can give some feedback or guidance. Alternatively, join the SwiftCrossUI Discord server and we can discuss things there.

stackotter avatar May 13 '25 07:05 stackotter