macos deployment target set to 11.0, but still getting pre-11.0 availability compiler warnings

Working on a macOS app, and I have the Deployment Target set to 11.0 in "General" > "Deployment Info".

However, despite that, I'm still getting compiler errors like:

'preferredColorScheme' is only available in macOS 11.0 or newer

And I'm having to add if #available(macOS 11.0, *) directives. Shouldn't Xcode realize that my deployment target is 11.0 and not force me to do the conditionals?

Replies

See this thread:

https://developer.apple.com/forums/thread/689517?answerId=687001022#687001022

It is the same for MacOS app: you have 2 places with deployment info and Deployment Target, which can be different (here one is 10.13 the other 11.3). Set them both to the correct value.

removed my duplicate

@Claude31 Thank you very much, that was my issue.