RunLoop modes are named differently in Swift 5.0 on macOS and Linux

(Diggory Laycock) #1

Hello, I've got Swift 5.0 running on Linux (Raspberry Pi) - Thanks @futurejones and @uraimo ! And also Swift 5.0 via Xcode 10.2 on macOS.

There seems to be a disparity in the types of RunLoop Modes. To keep both versions of the compiler happy I must do this:

func run() {
    #if os(macOS)
    while shouldKeepRunning == true &&
        runLoop.run(mode:RunLoopMode.defaultRunLoopMode, before: distantFuture) {}
    #endif

    #if os(Linux)
    while shouldKeepRunning == true &&
        runLoop.run(mode:.default, before: distantFuture) {}
    #endif
}
(Tony Parker) #2

Hi @Diggory,

Testing on 10.2 on Mojave (with that SDK), I still see the run loop mode named .default on macOS. Is there a configuration difference I'm not seeing?

(Diggory Laycock) #3

Ahhh, I hadn't looked at the build settings (the Xcode project was generated from an SPM package.)

The target build settings had the Swift Language Version set to 4.

Thanks.