-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Image
implementation, bump JSKit to 0.9.0
#155
Conversation
This comment has been minimized.
This comment has been minimized.
I think that both |
Could |
It probably could, but I'm not sure whether SwiftPM assumes a specific |
@MaxDesiatov is there a way to install the latest version of carton from GitHub? The released version doesn’t have resources yet. |
Yeah, you can clone the I hesitate to tag a new version because of a regression swiftwasm/swift#1824. OTOH, it's already broken in the current released version that ships 5.3 snapshots by default too. I hope to get it fixed soon, and failing that, will probably release it as is. Maybe I could release it after the next version of JSKit is tagged, so that it's compatible with DOMKit 🤔 |
Had a quick look at this, and according to SwiftUI docs We can't set |
This is required to make the `Image` view work as described in TokamakUI/Tokamak#155 (comment). * Demangle and print Firefox stacktraces in terminal * Update the entrypoints archive URL, rename file * Add missing newline to `ProcessRunner.swift` * Remove redundant `console.log` call from `dev.js` * Detect destination env from `User-Agent` header * Silence linter in tests where it can't be avoided * Add support for basic testing in browsers * Add a browser message on finish, shut down server * Serve main bundle resources from root directory * Fix archive hashes, bump JSKit in TestApp to 0.9.0 * Add comments to clarify behavior * Fix typo in doc comment in `Package.swift`
Image
implementationImage
implementation, bump JSKit to 0.9.0
@TokamakUI/core-team Now that swiftwasm/carton#176 is merged, this works with images supplied as SwiftPM resources. It does require specifying extensions with image names, and I don't think there's a clean way for us to infer extensions. I've removed Ready for review 🙂 |
|
||
import Foundation | ||
|
||
public struct Image: View { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to match some of SwiftUI's Image
modifiers we'll need to implement the internal storage as an AnyTokenBox
. Then once we add support for things like template images we can access the environment to render them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for highlighting this, I've created #312 to track it.
Note that all images must be specified explicitly in a manifest provided as a
tokamakDOM_provideImages
modifier. I tried adding the modifier when passing the view toDOMRenderer
but it didn’t work until I wrapped it in a view itself (is this a bug?)Since
carton
doesn’t support serving local static files, the demo requires an HTTP server running on port 5000 that serves static files from thedocs
directory.