Summary
Currently IfConfig (formerly IfCanImport) only supports #if canImport(Module). It should be expanded into a general-purpose conditional compilation block covering all Swift #if condition types.
Conditions to Support
.canImport("UIKit") → #if canImport(UIKit)(already works).flag("DEBUG") → #if DEBUG.os(.iOS) / .os(.macOS) / .os(.Linux) / .os(.Windows) etc..targetEnvironment(.simulator) / .targetEnvironment(.macCatalyst).swift(>=6.0) — Swift version check.compiler(>=6.0) — compiler version check.arch(.arm64) / .arch(.x86_64).hasFeature(...) / .hasAttribute(...)- Boolean combinations:
&&, ||, !
Clauses
#elseif support (additional IfConfigClauseSyntax entries)#else support
Related
#warning("message") and #error("message") could be added as separate CompilerWarning / CompilerError types using PoundDiagnosticDeclSyntax
Summary
Currently
IfConfig(formerlyIfCanImport) only supports#if canImport(Module). It should be expanded into a general-purpose conditional compilation block covering all Swift#ifcondition types.Conditions to Support
.canImport("UIKit")→#if canImport(UIKit)(already works).flag("DEBUG")→#if DEBUG.os(.iOS)/.os(.macOS)/.os(.Linux)/.os(.Windows)etc..targetEnvironment(.simulator)/.targetEnvironment(.macCatalyst).swift(>=6.0)— Swift version check.compiler(>=6.0)— compiler version check.arch(.arm64)/.arch(.x86_64).hasFeature(...)/.hasAttribute(...)&&,||,!Clauses
#elseifsupport (additionalIfConfigClauseSyntaxentries)#elsesupportRelated
#warning("message")and#error("message")could be added as separateCompilerWarning/CompilerErrortypes usingPoundDiagnosticDeclSyntax