19

I've upgraded to MacOS 11 (Big Sur) Beta 4. And Xcode 12 beta 4.

I have a Swift playground with Combine publishers:

Just([1,2,3])
    .setFailureType(to: Error.self) // Make the compiler pick up new API in MacOS Big Sur
    .flatMap { $0.publisher }
    .sink(receiveCompletion: { print($0) }, receiveValue: { print($0) })

After upgrading my playgrounds start to fail with the message: "'flatMap(maxPublishers:_:)' is only available in macOS 11.0 or newer". The swift compiler dosen't indicate any errors in the code. And the code works fine if placed in a normal Xcode command line app project.

The error can be mitigated by enclosing the publisher in a availability check like, if #available(macOS 11.0, *) { } in the playground.

I'm assuming this is a bug and I've filed an issue with Apple.

Or is this expected behavior? And if it is ... is there a way to hint to a playground what deployment target to assume? If it's not correctly picking up the actual version of the operating system it's running against.

Thanks!

weenzeel
  • 797
  • 5
  • 17

0 Answers0