[HN Gopher] Capacitor: Cross-platform native runtime for web apps
       ___________________________________________________________________
        
       Capacitor: Cross-platform native runtime for web apps
        
       Author : thunderbong
       Score  : 104 points
       Date   : 2021-10-29 18:30 UTC (1 days ago)
        
 (HTM) web link (capacitorjs.com)
 (TXT) w3m dump (capacitorjs.com)
        
       | no_wizard wrote:
       | How does this compare with NativeScript? I know it can work with
       | capacitor but unlike ionic it complies down to actual native UI
       | and not mostly web views, is capacitor Ionics answer to just
       | being glorified web views?
        
       | [deleted]
        
       | taylorfinley wrote:
       | Maybe I've just been doing this too long but my first reaction
       | was "Another one??"
        
         | boomskats wrote:
         | Capacitor has been around for a while, at least for a couple of
         | years. I think it's the Ionic team's response to the EOL for
         | Cordova/Phonegap.
         | 
         | I've been stung by ionic/drifty a couple of times, but I really
         | hope this project survives. There are some great ideas here.
        
           | yesimahuman wrote:
           | Sorry you've been stung before! Capacitor is definitely here
           | to stay. The project has been taking off recently and is
           | powering the majority of apps for our users and customers
           | today. Also we're starting to see more platforms that used to
           | be powered by Cordova start to switch to Capacitor so that
           | should further solidify its staying power.
        
           | the-dude wrote:
           | Recently I had to rebuild an iOS app originally built in
           | Ionic2 / Cordova 4.5.
           | 
           | I was pleasantly surprised it basically built in one go on a
           | fresh MacOS install with the latest Ionic and Cordova 6.5.
           | 
           | I didn't expect that.
        
       | gogopuppygogo wrote:
       | Here is an alternative I've used for years: https://gonative.io/
        
       | endisneigh wrote:
       | It's a shame that the rules are so convoluted for the App and
       | Play stores.
       | 
       | Otherwise you could make a "App Director" app and then just have
       | people use your web app. As native functionality is needed it
       | will delegate to the "App Director" app. Perfect example being
       | notifications and interfacing with things like the calendar and
       | contacts.
       | 
       | This sort of app wouldn't be allowed on both stores.
        
         | solarkraft wrote:
         | Why would it not be allowed on Google Play?
        
       | drannex wrote:
       | I develop and maintain a relatively popular open source Svelte[1]
       | template (w/ live reload!) to develop cross platform apps.
       | 
       | Capacitor really is a beauty to work with. While I disagree on
       | some design decisions (putting build platforms at the root of the
       | directory for one) the overall ecosystem is quite healthy and
       | strong, and while backwards compat with Cordova is hit or miss,
       | its quite good for a tool thats a decade old.
       | 
       | [1]. https://github.com/drannex42/svelte-capacitor
        
       | the-dude wrote:
       | How come all top level comments are from the same time? ( for me,
       | now, 47 minutes ago )
        
         | jsnell wrote:
         | I think it's a HN feature related to a post with existing
         | comments being boosted to the frontpage by a moderator. The
         | timestamps of both the post and the existing comments are faked
         | for a time period to appear consistent with the time of the
         | boost rather than the original post.
         | 
         | I.e. all the comments were not posted at the same time just
         | now, but over a longer time period hours ago.
        
         | MikeTheGreat wrote:
         | That's a really interesting observation!
         | 
         | To be fair, there's only 4 top-level comments from that same
         | time. Given a big enough audience it's reasonable to think that
         | this would happen from time to time.
         | 
         | There doesn't appear to be any particular bias / agenda from
         | the posts (that I can see) so I'm guessing it's just
         | coincidence.
        
           | the-dude wrote:
           | Ah, it seems to be a submission from the second hand pool (
           | https://news.ycombinator.com/pool ).
           | 
           | That would make sense, as it popped up on the FP?
        
       | yesimahuman wrote:
       | Capacitor creator and co-founder of Ionic here (company that owns
       | and works on Capacitor).
       | 
       | If you aren't familiar with Capacitor, it's a way for web devs to
       | build cross-platform apps using standard web technology and any
       | popular web stack. For example, you can build mobile apps using
       | popular stacks like Next.js + Tailwind as in this example:
       | https://github.com/mlynch/nextjs-tailwind-ionic-capacitor-st....
       | 
       | We've got some exciting things in the pipeline like a Project API
       | for automating configuration (whitelabling/CI/etc), E2E testing,
       | easier native HTTP features, resource generation
       | (splash/icon/etc).
       | 
       | Happy to answer any questions about Capacitor!
        
         | la_fayette wrote:
         | I am very happy using ionic, stencil and capacitor! You are
         | really doing a great job, thank you!
        
         | archibaldJ wrote:
         | How does this compare to React Native from a build-tool
         | persepctive? From experience Native, Cordova, Xamarin, etc, all
         | took a while for their build-tools to mature (mostly by making
         | the right trade-offs) so to allow a degree of freedom without
         | running into some build hells (though sometimes still do). It's
         | for this reason that I normally just go plain objc/swift/java
        
         | sroussey wrote:
         | Capacitor puts all APIs in the same context and thread as the
         | UI. Something that Electron did a long long time ago before
         | realizing the security implications.
        
           | difosfor wrote:
           | What do you mean exactly? Could you give an example?
        
             | dwaite wrote:
             | XSS gain access to native API
        
           | yesimahuman wrote:
           | You are correct that Capacitor plugin API entry points are in
           | the same thread as your web/UI code (which will run in a
           | separate process from your native plugin code given WKWebView
           | sandboxes your app in a separate process. They communicate
           | through message passing only). I don't think it's directly
           | comparable to Electron for a few reasons. What Capacitor is
           | doing is more like adding new Web APIs to the browser. You
           | have full control over which of those APIs are exposed and
           | they are all backed by the native sandboxing and permission
           | model available on each platform. Additionally you are almost
           | always only loading trusted local content. Electron exposing
           | node runtime to untrusted remote content running in
           | unsandboxed win32 apps, for example, is a pretty different
           | beast. We do take security seriously though and would be
           | happy to review or consider how we can enable users to lock
           | down their apps even more.
        
         | adflux wrote:
         | Whats the usecase of capacitor vs using a tool like
         | pwabuilder.com to deploy pwas to the app stores?
        
           | yesimahuman wrote:
           | Capacitor let's you add any native functionality that you
           | need to create your full native app experience. Also keep in
           | mind you can't just wrap a PWA and expect it to be accepted
           | into the App Store without adding some additional native
           | functionality which Capacitor provides
        
         | benoits wrote:
         | Some of those things in the pipeline like wkwebview-friendly
         | HTTP sound great, would we be able to more easily see requests
         | in the browser Dev tools for instance (a la native browser
         | fetch)? Also can we expect any perf improvements over Cordova
         | (I assume rendering perf would be identical)?
        
         | _fat_santa wrote:
         | Hey! React Native developer here.
         | 
         | What advantages do you think Capacitor has over React Native?
        
       | hulitu wrote:
       | 1F or 1pF ? I wish that people will be more creative when
       | choosing names for their pet projects. It really helps when
       | searching.
        
       | ssss11 wrote:
       | Anyone using this care to weigh in with pros/cons/comparisons?
        
         | glutamate wrote:
         | Their docs have a comparison with Cordova here:
         | https://capacitorjs.com/docs/cordova
        
         | yesimahuman wrote:
         | Not a direct answer to your question but this was a great write
         | up from the BBC (they use Capacitor): https://medium.com/bbc-
         | design-engineering/shipping-progressi...
        
         | simonbarker87 wrote:
         | I've made 3 apps with Ionic and Capacitor (2 released, one
         | large that I abandoned).
         | 
         | While it's great the enormous draw back is reliance on crappy
         | community plugins and using old Cordova stuff to access native
         | features.
         | 
         | They have nice premium stuff behind the enterprise paywall but
         | they don't offer prices and make it pretty clear that they're
         | not interested in speaking to a small indie dev.
         | 
         | I eventually abandoned my "big" project on Ionic due to this
         | issue. This was about a year ago.
         | 
         | I looked at React Native and that seems to at least have more
         | options but I'm not sure if it will be better.
        
       | say_it_as_it_is wrote:
       | Web Native Apps?
        
         | agloeregrets wrote:
         | Yeah, this was made by the team behind ionic...which has a long
         | history Of trying to twist words in their favor and sell their
         | framework.
         | 
         | Personally,it's just Cordova in a different suit and isn't
         | remotely related to what native means on mobile. The entire
         | reason they are selling their framework so hard is under the
         | enterprise tab in the menu.
        
           | yesimahuman wrote:
           | It's not just Cordova in a different suit. There are a lot of
           | similarities, but there are some pretty big differences. For
           | example, Capacitor has first-class support for Progressive
           | Web Apps and can be used as a library you link with that
           | comes with an abstracted set of APIs for accessing
           | native/device features on iOS/Android/Desktop/Web with the
           | same codebase. There are a ton of small decisions that all
           | add up to a pretty dramatically different experience and our
           | Web Native moniker represents our focus on building an app
           | that is native to the web and then running it on all the
           | platforms you care about with full access to the native
           | features you need on each platform.
           | 
           | And don't just take my word for it, the feedback from actual
           | users is that the experience is dramatically better than
           | Cordova. For example, see the 2020 State of JS survey
           | results: https://2020.stateofjs.com/en-
           | us/technologies/mobile-desktop...
           | 
           | Also on the Enterprise tab, the other way to look at this is
           | we have a sustainable revenue and funding model for the
           | project that is aligned with actual users of the project (as
           | opposed to this being an internal project we just happened to
           | OSS for goodwill/hiring benefits). I'm really proud of that
           | and consider it a huge advantage of the project.
        
       | candiddevmike wrote:
       | Capacitor user here (with Mithril/Typescript). It's OK for what
       | it does but everything feels very fragile and I get freaked out
       | anytime I have to touch the Android or iOS code for fear of
       | breaking it. The plugin ecosystem is also a bit of a quagmire of
       | abandoned repos and figuring out if you can still use things from
       | Cordova without too much fuss.
       | 
       | I tried going the TWA route for the Play Store but there isn't an
       | IAP solution yet (and I can't use Stripe because...). I look
       | forward to not needing Capacitor in the future, but for now it
       | mostly stays out of the way.
        
       | exhilaration wrote:
       | There were a bunch of mostly positive comments about Capacitor in
       | yesterday's PWA Builder discussion if you want to compare the
       | two: https://news.ycombinator.com/item?id=29040793
        
       ___________________________________________________________________
       (page generated 2021-10-30 23:01 UTC)