Skip to content
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

Embed a Figure in WebView on iOS/ipadOS #11

Closed
alew3 opened this issue Apr 21, 2020 · 10 comments
Closed

Embed a Figure in WebView on iOS/ipadOS #11

alew3 opened this issue Apr 21, 2020 · 10 comments
Labels
question Further information is requested

Comments

@alew3
Copy link

alew3 commented Apr 21, 2020

Very excited to see your work on the Tensor4Swift mailing list. Is it possible to be used inside a WebView in an IOS app?

@vojtamolda vojtamolda added the question Further information is requested label Apr 21, 2020
@vojtamolda
Copy link
Owner

Hello @alew3,

There's a XCode Playground example that uses WebView to display the chart inside of the Playground's liveView. It's using AppKit (i.e. macOS) at the moment but I don't see anything anything specific to prevent it from working with UIKit (i.e. iOS/ipadOS) as well.

Here's the piece of code that creates the WebView: Plotly/Extensions/Playground.swift
Here's the link to the Playground: Examples/Playgrounds/

I'm not an iOS/macOS developer so any PRs or feedback to make the embedding easier would be welcome if you decide to try it.

Per issue #7 I'd like to eventually create a dedicated standalone app for chart viewing and to make the app more versatile it could be actually written with Catalyst in mind to make it work anywhere.

@vojtamolda vojtamolda changed the title IOS Embed a Figure in WebView on iOS/ipadOS Apr 21, 2020
@vojtamolda
Copy link
Owner

@alew3, how did the WebView embedding go? Did you have any luck with it?

@vinbrule
Copy link
Contributor

@vojtamolda Thank so much for the awesome work. I'd like to contribute the functions to make it works on iphone and ipad. I am still looking for starting point. Could you help me? If it's long, we can talk for 20 minutes about the solution on Zoom, Hangout, Skype, etc?

@vojtamolda
Copy link
Owner

Hello @vinbrule

Thanks a lot for willing to contribute! You made my day.

I have a rough plan for something similar as part of issue #7. I was thinking about designing a reusable PlotlyView that would wrap a WebView and expose a property of type Figure to set the currently displayed chart. The viewer app itself would then be a relatively thin wrapper around this reusable UI component.

Originally, I didn't plan to make it work on iOS/iPadOS. But since there seems to be a lot of demand, I think it can be slightly changed to meet your needs. To make the viewer app work in both worlds #7 can use Catalyst framework. It's relatively new thing but we can get the app to work on any Apple platform from the same codebase.

From the source code perspective, it basically means we'd have to use UIKit instead of AppKit that a "regular" macOS app would use.

@vojtamolda
Copy link
Owner

We should probably open a new issue just for the development of the PlotlyView and have the discussion there. What do you think?

@vinbrule
Copy link
Contributor

@vojtamolda That is a great idea! Please make it and put some comments, and some very basic starting point in codes if possible. It will significantly reduce the start-ing up time :)

@vojtamolda
Copy link
Owner

@vinbrule I've created #14 with some starting comments so we can continue the discussion there.

Also, please, send me an email so we can setup a Zoom call to get you up to speed. I wasn't able to dig up any contact info on your GitHub profile.

Good thing is that we're in the same time zone!

@vinbrule
Copy link
Contributor

vinbrule commented Jun 1, 2020

@vojtamolda sent you a greeting already and now my email on github is public also

@alew3
Copy link
Author

alew3 commented Jun 1, 2020

@alew3, how did the WebView embedding go? Did you have any luck with it?

Sorry for not replying faster, unfortunately I'm a newbie in the Swift world and I didn't have time to dig further.

@vojtamolda
Copy link
Owner

@alew3 No worries. Hopefully, will have something much easier to use for you soon! Check out #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants