You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if #available(Safari 14, Edge 79, Firefox 68, Chrome 67){
// code that uses `JSBigInt`
else{
// backward-compatible code
}
Ideally, one would write:
if #available(JSBigInt){
// code that uses `JSBigInt`
else{
// backward-compatible code
}
but this doesn't match the existing semantics of #available, which checks for platforms, not features. And making the toolchain aware of every feature is not realistic in my opinion. Besides, AFAIR Xcode (and hopefully SourceKit-LSP) fix-its propose adding corresponding platform version checks automatically after you attempt to use a "future" API when targeting older platforms.
The text was updated successfully, but these errors were encountered:
When writing requirements for swiftwasm/JavaScriptKit#56, it reminded me of my old idea for browser version checks in Swift:
Then user code could look like:
Ideally, one would write:
but this doesn't match the existing semantics of
#available
, which checks for platforms, not features. And making the toolchain aware of every feature is not realistic in my opinion. Besides, AFAIR Xcode (and hopefully SourceKit-LSP) fix-its propose adding corresponding platform version checks automatically after you attempt to use a "future" API when targeting older platforms.The text was updated successfully, but these errors were encountered: