Skip to content

[Migration] Road to Swift 6 #315

@nicoverbruggen

Description

@nicoverbruggen

PHP Monitor was originally written before Swift 6 and strict concurrency checks were a thing.

I've been doing a quick look every year or so to see if it's gotten any easier to migrate this codebase to Swift 6.

It'll be a tad tricky, but I think next year is the ideal time to bite the bullet.

Currently:

  • PHP Monitor uses Swift 5 and so the inherited default is basically nonisolated async behavior
  • I've been improving Swift concurrency usage in various places
  • Some legacy code and framework use remains
  • I've recently adopted NSLock for some features where an easy refactor to proper Swift actors was not possible
  • I've tried the MainActor default setting (there's work to do!) in Xcode 26 and there's a bit of work required
  • Some legacy code related to hotkey management may need to become a package w/ Swift 5 mode because it's troublesome
  • Some code related to the warning system won't compile in Swift 6 mode
  • I have not tried the strict checks with Swift 5 yet, which I should do soon enough

I am curious to see how tools like Claude Code could be of use for me for this kind of stuff. I've definitely been able to identify some bugs and issues and resolve problems by asking for more information via LLMs.

What's next:

  • Update the separate dev/swift-6 branch with the latest 25.12 changes
  • Try strict checks with Swift 5
  • Fix hotkey management code (Remove hotkey management code into separate NV package)
  • Identify remaining issues with Swift 6 mode
  • Fix remaining issues with Swift 6 mode
  • Identify and fix slow test suite (currently 5 sec nonisolated default, 25 sec MainActor default, unsure if it's my fault)
  • Add more UI tests and validate all works as expected (no hangs)

Metadata

Metadata

Labels

investigation neededFurther investigation is needed at some point

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions