Skip to content

Conversation

@benbenbenbenbenben
Copy link

Hi,

I'm opening this for discussion as I'm currently experimenting with NATS on iOS & Linux. It requires minimal changes to make this repo build on Linux, but most of those changes are in dependencies:

Jarema/swift-nuid#1

nats-io/nkeys.swift#9

Each pull request, those above and this one include a devcontainer file to test the Linux build. It is minimal but I can appreciate if it is considered clutter. Nevertheless, the changes required are minimal.

@stalkermv
Copy link

Any updates here?

@robinhayward
Copy link

Need this please 🚀🚀🚀

@robinhayward
Copy link

Thanks @benbenbenbenbenben

@Jarema
Copy link
Member

Jarema commented Jul 14, 2025

Will get back here shortly. Sorry for the delay!

@Jarema
Copy link
Member

Jarema commented Jul 23, 2025

As both nuid and nkeys were updated, please update the PR to use those new releases instead @benbenbenbenbenben

@morenonicolelli
Copy link

Thank you @benbenbenbenbenben!! I was searching this solution!! I hope this PR will be integrated asap

@benbenbenbenbenben
Copy link
Author

Sorry about that delay there @morenonicolelli - all dependencies restored to the original repos and we're good to go!

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

Some small nits.

@benbenbenbenbenben
Copy link
Author

Got em'

@avmwilliams
Copy link

Hi folks. I could really use this update (need to deploy server-side swift to container on linux), and wondering if there's a plan to merge the PR soon? Looks like it's almost good to go? Thanks to all for this great package.

Copilot AI review requested due to automatic review settings November 18, 2025 16:48
Copilot finished reviewing on behalf of piotrpio November 18, 2025 16:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds cross-platform support to nats.swift, enabling it to build and run on Linux in addition to macOS and iOS. The changes are minimal and focused on platform-specific compatibility requirements.

  • Adds conditional imports for FoundationNetworking (required for URLSession on Linux)
  • Implements conditional crypto library imports (CryptoKit on Apple platforms, swift-crypto on Linux)
  • Updates dependency versions to support cross-platform builds (nkeys.swift 0.2.0, swift-nuid 0.3.0)
  • Adds swift-crypto as a Linux-specific dependency for JetStream
  • Removes unused import Combine statement
  • Includes devcontainer configuration for Linux build testing

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/NatsTests/Unit/JwtTests.swift Adds conditional import of FoundationNetworking for Linux URLSession support
Sources/Nats/NatsConnection.swift Adds conditional import of FoundationNetworking for Linux URLSession support
Sources/JetStream/JetStreamContext.swift Removes unused Combine import
Sources/JetStream/Consumer.swift Adds conditional crypto imports (CryptoKit for Apple platforms, Crypto for Linux)
Sources/BenchmarkPubSub/main.swift Updates async iteration syntax, likely for Swift 6 concurrency requirements
Package.swift Updates dependency versions and adds swift-crypto as Linux-conditional dependency for JetStream
.devcontainer/devcontainer.json Adds devcontainer configuration with Swift 6.0 for Linux development and testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@avmwilliams
Copy link

Hi @Jarema - Many thanks for picking this up again and for posting the review. I'm really keen to use this change if we can make it stick.

Hi @benbenbenbenbenben - I appreciate this sits with you and it's been a while since you raised. If you're able to find time to action this one small review comment that would be absolutely amazng. If not, (which I totally get if you've moved on to other things!), let me know and if you're both happy, perhaps I can create a new PR/branch to take over the update and apply the changes so we can finalise?

Thank you both - totally love this package and to be able to use it on Linux would be a game changer for me. Happy to help, just let me know how to do that for the best.

Appreciate the efforts!

@Jarema
Copy link
Member

Jarema commented Nov 23, 2025

@avmwilliams let's give @benbenbenbenbenben few days, and in case of lack of time, let's transfer the work to you on new PR. It is quite close to be done.
I really appreciate the initiative @avmwilliams !

@avmwilliams
Copy link

Of course, no pressure intended. Just an offer of help :)

@benbenbenbenbenben
Copy link
Author

It's good to go as far as I'm concerned.

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.

8 participants