Closed inamiy closed 2 years ago
@inamiy Thanks for the PR! Because we're not quite familiar with why some of these APIs are available on WASM and some aren't I think we'd like to get some CI in place before merging. (Like why the extension Date
isn't allowed but as Date
in the NSDate
extension is.) We'll try to look into that soon!
@stephencelis
For extension Date
, IIRC the issue rather lives in TimeZone
which SwiftWasm's modified Foundation doesn't allow it as mentioned in the above doc:
A few other types are unavailable in browsers or aren't standardized in WASI hosts, such as support for sockets and low-level networking, or support for time zone files, and they had to be disabled.
And here's the steps I tried to detect compile errors (It's in doc too):
# swift-latest = SwiftWasm toolchain
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
# For lib compile:
swift build --triple wasm32-unknown-wasi
# In the SwiftWasm demo app:
carton dev
@inamiy Thanks! That'll be helpful in getting CI up and running :smile:
@inamiy Got CI working on another branch, thanks! Gonna merge this, get the rest into main
, and kick off a release.
Related:
This PR adds
if !os(WASI)
for the scopes where some of the Foundation classes don't work in SwiftWasm.Porting code from other platforms - Swift and WebAssembly