Import Logger in Swift Package gives error when building for iOS only

Viewed 224

I created a new Swift Package and added this to the Package.swift:

platforms: [
    .iOS(.v14)
],

In the source file, I added this code:

import OSLog
let log = Logger()

Now I get this error:

'Logger' is only available in in macOS 11.0 or newer

That is strange, since it should also be available on iOS 14>: https://developer.apple.com/documentation/os/logger

How can I solve this error while NOT adding macOS to the platforms? I don't want to build for macOS.

1 Answers

Is your framework pointing to My Mac by chance? Try changing it to an iPhone.

Build destination

Related