Skip to content

feat: Add support for wasm compilation#2680

Closed
scottmarchant wants to merge 3 commits intoReactiveX:mainfrom
PassiveLogic:feat/swift-wasm-support-v3
Closed

feat: Add support for wasm compilation#2680
scottmarchant wants to merge 3 commits intoReactiveX:mainfrom
PassiveLogic:feat/swift-wasm-support-v3

Conversation

@scottmarchant
Copy link
Copy Markdown

Change summary

DRAFT ONLY

Adds support for compiling RxSwift to wasm using the Swift for WebAssembly SDK.

Change details

  • Several preprocessor statements used to enable wasm compilation
  • Added new swift-atomics and swift-dispatch-async dependencies for WASM builds only

Outstanding tasks

The following tasks need completed for this PR to exit draft phase.

  • Evaluate any CI failures
  • Evaluate the hack and todo items in this diff. Consider possible courses of action or whether the tradeoffs are acceptable for now
  • Add CI to ensure wasm builds keep compiling with future changes

Testing Done

Tested compiling and running this as part of a large web app.

Note that this PR is part of a larger effort by PassiveLogic to improve Swift for WebAssembly support.


func dequeueNextAndSubscribe() {
if let next = queue.dequeue() {
// HACK: concatMap depends on MergeLimitedSink, which depends on CurrentThreadScheduler.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freak4pc This PR is in DRAFT for now. It adds wasm compilation to RxSwift. I had to make a few changes that I would consider a hack, especially this. This isn't a terrible hack since it is isolated to wasm only, and since wasm is currently pretty much single-threaded.

But I wanted to call this out.

If you're interested in merging this with this wasm-only hack in place, then I'm happy to move this PR out of draft. But I'm not sure I'll have resources to fully implement a full solution for CurrentThreadScheduler, since our company went a different way other than RxSwift.

@scottmarchant
Copy link
Copy Markdown
Author

Closing this PR as there doesn't seem to be interest. Happy to re-open if someone wants these changes. Please @ mention me in a comment if the need comes up.

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