Detect all uses of declarations that are deprecated in any version of Swift or its platforms

How can I detect all uses of declarations that are deprecated in any version of Swift or its platforms?

e.g., my SwiftPM project uses Swift 6.0 and requires macOS 10.15 or newer.

When I locally updated it to require macOS 13 or newer, I never got any build warnings about the following function, which is deprecated in 26.2 & whose replacement is available in macOS 13 & newer.

Deprecated function:

Replacement function:

I locally updated my project to require macOS 26 or newer, but that didn't warn about deprecations for 26.2.

I don't know how to require macOS 26.2 (or 27) or newer (I don't think it's even possible, but maybe someone knows a way to do it).

I want to detect all deprecated declaration uses, even if they were deprecated after the latest platform version that can be specified in SwiftPM. Maybe this can be achieved by swift options, Package.swift settings, Xcode actions, a third-party tool or build plugin, etc.