79543719

Date: 2025-03-29 18:36:15
Score: 3
Natty:
Report link

@timbre's answer makes many good points and is worth an up-vote. But it didn't answer exactly what I needed. So here's what I came up with.

See this article for how I came up with 6.0 corresponding to target SDK macOS 15

#if swift(>=5.0)
    ...swift code...
#else
    ...old approach...
#endif


#if canImport(SwiftUI, _version: "6.0") //hack to test for macOS 15 target sdk
    ...swift code...
    ...perhaps using #available if deployment sdk is older...
#else
    ...old approach...
#endif
Reasons:
  • Blacklisted phrase (1): this article
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • User mentioned (1): @timbre's
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Mustang