简体   繁体   中英

WebView as GUI in OSX application

Update 09/25/2015 - I'm updating this question for posterity, in hopes that its helpful to anyone wondering the same thing

The answers provided by the stack overflow community gave me some reassurance, but further research showed me that Using WebKit/WebView for a GUI in OSX applications is perfectly reasonable.

Apple actually does this for the following OSX apps:

  • Messages
  • iBooks
  • Mail

Performance is the thing I was most concerned about. It turns out that WebViews run in their own process, so that pretty much removed my concerns.

More info as well as some examples can be found in this apple developer video. https://developer.apple.com/videos/wwdc/2014/?id=206

Original Question Below

my team is new to cocoa development but experienced in C++ and JS. We currently have a functional web application of our product that we want to implement as a mac application.

We were wondering if developing the GUI using webkit instead of application kit would pose any serious problems. Our main reason for doing this is familiarity with Web GUI's and code reuse between platforms.

Ideally, the Javascript UI would communicate with the C++/Obj-c through protocol buffers . That being said, we'd also like to start on solid footing.

Does this approach seem unreasonable/pose problems that we may not be considering?

No, this is not unreasonable.

On iOS a lot of frameworks exist for doing things like this, such as http://phonegap.com/ .

I personally don't think wrapping web code is a great choice for iOS or Mac apps. I would caution you about performance, native look and feel, GUI responsiveness, access to filesystem or features, but it is certainly possible and an ok option in very specific cases.

Check Sciter too, while it uses tiscript instead of Java script, it allows to define your UI in HTML/CSS.

It was designed specifically for desktop UI - it has specific UI features like real HTML dialog and frame windows, windowed popup elements that are still DOM elements, clipboard, etc.

This 在此处输入图片说明 is HTML/CSS window.

And it allows to run exactly the same UI on all desktop platforms using C/C++ native API of the engine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM