[HN Gopher] Svelte Native: The Svelte Mobile Development Experience
       ___________________________________________________________________
        
       Svelte Native: The Svelte Mobile Development Experience
        
       Author : thunderbong
       Score  : 126 points
       Date   : 2024-01-29 12:13 UTC (10 hours ago)
        
 (HTM) web link (svelte-native.technology)
 (TXT) w3m dump (svelte-native.technology)
        
       | miohtama wrote:
       | Super, I love Svelte and I hope its unique component model fits
       | well for the native mobile app development.
       | 
       | Is the tool chain very different from React native?
        
         | woahitsraj wrote:
         | It is. This is mostly a Svelte wrapper around NativeScript so
         | it's really not equivalent
        
       | oneseven wrote:
       | Whatever the merits of this project -- and it does seem to be
       | useful -- they should be a little clearer about the fact that
       | it's not actually part of the "official" svelte framework.
       | 
       | I'm sure they consider it a tribute but it fees a little
       | deceptive that they're cloning the svelte docs look and feel
       | without any kind of "who we are" statement.
        
         | kevinak wrote:
         | Back when Svelte Native was created it was pretty much endores
         | by the maintainers, there's even a channel for it on the
         | official Svelte Discord :)
        
       | kvgr wrote:
       | The example app is 5 years old. Is anybody using this?
        
       | hd4 wrote:
       | Is the goal here to reach a minimum subset of basic Android UI
       | functionality? I don't see any push to try and replicate a MD3
       | feature-set here for example.
        
       | OJFord wrote:
       | I think if you're starting today you'd be better off with Tauri
       | (and Svelte as the framework)?
        
         | CharlesW wrote:
         | Tauri Mobile seems far from production-ready, but more
         | importantly, the reason to use something like Svelte Native
         | instead of Tauri Mobile is to _avoid_ web views in favor of a
         | platform-native experience.
        
         | pjmlp wrote:
         | I would rather stick to either pure mobile Web, or native views
         | + C++, but that is me.
         | 
         | No added tooling, only the SDKs from each platform, no late
         | nights debugging integration layers, lack of support on
         | IDEs,...
        
           | ultra_nick wrote:
           | SDKs for 4+ platforms is added tooling...
        
             | pjmlp wrote:
             | It is when it represents debugging the same code 4+ times.
             | 
             | That is the fallacy of all these leaky abstractions, the
             | need to actually know the native APIs from each platform
             | doesn't go away.
             | 
             | Someone needs to take care of integration problems.
        
       | gmaster1440 wrote:
       | This is not so much the Svelte equivalent of React Native as it
       | is just one of the wrappers for NativeScript
       | (https://nativescript.org).
        
       | lawgimenez wrote:
       | Native is such an abused word.
        
         | eximius wrote:
         | True. I think the intent here is "we translate your stuff into
         | non-webviews" which is... pretty much what native means in a
         | mobile context.
        
         | jbverschoor wrote:
         | They're making native calls.. Either through message passing,
         | or through creating stubs.
         | 
         | You can literally use all of the iOS SDK directly.
         | 
         | Not sure why I'm downvoted..
         | https://old.nativescript.org/native-api-access/
         | 
         | It's the basis of their entire product. On top of that they've
         | built cross-platform wrapper for many UI things. And on top of
         | that, they've integrated several toolkits.
         | 
         | They just market it the other way around, which i.m.o. is not
         | helping them with traction. Right now they're always competing
         | with many other products (react native for example), even
         | though they have a very unique product.
        
       | PolCPP wrote:
       | Yuck nativescript
        
         | ca-tech-run wrote:
         | Doesn't look too yuck https://nstudio.io/success-
         | stories/blackout-lighting-console
        
       | solarkraft wrote:
       | Why does NativeScript seem so much worse than React Native?
        
         | TomatoTomato wrote:
         | Funding? Plugin ecosystem like Expo modules? Or maybe use both?
         | 
         | https://blog.nativescript.org/nativescript-with-react-native...
         | 
         | https://twitter.com/wwwalkerrun/status/1700719038392078607
         | 
         | Then throw in some SwiftUI too
         | 
         | https://twitter.com/NativeScript/status/1624895622540328961
        
       | papa_bear wrote:
       | My company tried using this a few years ago to build a cross
       | platform app (and hopefully share a lot of code with our svelte
       | web interface). We made a lot of progress in 3-4 months of
       | trying, but we ended up running into too many odd bugs and edge
       | cases that were difficult to debug. We eventually switched to
       | Flutter for the mobile codebase.
       | 
       | No doubt this and nativescript have improved since then, but from
       | my early impressions, I wouldn't have recommended nativescript
       | for anything other than the simplest of interface needs.
        
         | scosman wrote:
         | This is the story I've heard about almost every react native
         | project.
         | 
         | Get to proof of concept 10x faster. Spend 10x more time in the
         | weeds on weird bugs.
        
           | rhodysurf wrote:
           | NativeScript is not react-native
        
           | mixmastamyk wrote:
           | Also the old Cordova equivalent and Kivy. Take mobile
           | development and try to shoehorn a browser-based solution
           | (they don't want) into it. Now you've got two problems and
           | not enough expertise available to help.
        
         | TSiege wrote:
         | How has Flutter compared in your experience?
        
         | ca-tech-run wrote:
         | Pretty sophisticated interface needs here with NativeScript:
         | https://nstudio.io/success-stories/blackout-lighting-console
        
       | woahitsraj wrote:
       | While I'm a huge Svelte fan, this project hasn't really gotten
       | very much care and attention over the last few years.
       | 
       | Which is honestly fine. React and React Native I think do a much
       | better job of filling the niche of people who want to build
       | native apps with web tech.
       | 
       | That being said, I think with the progress that Safari has made
       | in implementing PWA support, the increased hostility of Apple
       | toward native developers, and browser improvements like WebGPU
       | coming out soon, I really hope that we no longer have to build
       | native apps for like 95% of use cases. The only major hurdle to
       | this is Apple continuing to treat web apps as second class
       | citizens on iOS and only begrudgingly adding APIs to Safari to
       | make good native experiences.
        
         | sacrosanct wrote:
         | > The only major hurdle to this is Apple continuing to treat
         | web apps as second class citizens on iOS
         | 
         | If you add a site to iOS' homescreen it automatically becomes a
         | PWA. The best example I found of a site fully leveraging this
         | feature is Cryptee[0]. They talk about the PWA thing here:
         | https://crypt.ee/download
         | 
         | [0] https://crypt.ee/
        
           | throwitaway1123 wrote:
           | The whole add to home screen process is needlessly
           | convoluted. It would be nice if there was something similar
           | to Smart Banners for PWAs: https://developer.apple.com/docume
           | ntation/webkit/promoting_a...
        
             | ezfe wrote:
             | You just click "Share -> Add To Home Screen." I understand
             | that that's technically more clicks than a smart banner but
             | hardly "convoluted"
        
               | throwitaway1123 wrote:
               | I think it's convoluted relative to a Smart Banner. Smart
               | Banners give users a clear call to action, and they're
               | not buried in a menu somewhere.
               | 
               | It's hard to make this point without linking to a
               | screenshot, but the share menu is incredibly bloated. To
               | get to the add to home screen button a user has to know
               | it's in the share menu (which is just an unlabeled icon),
               | and then scroll past the following menu items:
               | 
               | - An options button (which leads to another menu)
               | 
               | - Air Drop
               | 
               | - Share via text message (with several different contacts
               | listed individually to share with)
               | 
               | - Copy
               | 
               | - Add to Reading List
               | 
               | - Add Bookmark
               | 
               | - Add to Favorites
               | 
               | - Add to Quick Note
               | 
               | - Find on Page
        
         | tootie wrote:
         | We've been working with Capacitor recently which is the current
         | iteration of webview-to-native. Basically you just build a
         | website and run it through a compile step to output iOS and
         | Android. The ergonomics of the build process and integration
         | with native features is definitely a bit lumpy, but we've been
         | very successful at building an all-in-one codebase that will
         | power web, ios and android with minimal drift.
        
           | kevinak wrote:
           | Not sure what you built but for anyone interested in going
           | down this venue there's a blog post by a Svelte Ambassador
           | that you can read here: https://khromov.se/how-i-published-a-
           | gratitude-journaling-ap...
        
           | roldyclark wrote:
           | Capacitor is great! Did Svelte + Capacitor for my last app.
           | Highly recommend.
        
         | dickersnoodle wrote:
         | > increased hostility of Apple toward native developers
         | 
         | Chortle.
        
       | la_fayette wrote:
       | I have built many mobile apps in the last years. I always used
       | web technologies rendered inside webviews, using tools like
       | capacitorjs.
       | 
       | Since I am very concerned with user experience, I always
       | considered the perceivable UI rendering performance as highly
       | important. For contemporary smartphones I cannot see any benefit
       | in using tools like react native, flutter, nativescript in
       | contrast to rendering inside a webview.
       | 
       | I think UI libraries like ionic are indistinguishable from native
       | UI components. At least, to the best of my knowledge, there is no
       | real user study, which proves the contrary. So why should one use
       | such cross-platform tools and not use svelte directly with a
       | webview?
        
         | crowdyriver wrote:
         | Have you experienced slow scrolling issues?
         | 
         | https://github.com/ionic-team/capacitor/issues/4187
        
         | refulgentis wrote:
         | I very much doubt Ionic is _visually_ indistinguishable from
         | native UI components, but I 'd love to try if you have a good
         | demo link.
         | 
         | My guess is it crosses a "good-enough" threshold for usability,
         | and it feels objective, ex. maybe scroll performance is the
         | same.
         | 
         | I _strongly_ believe users notice things feeling  "off" in a
         | way that's either subconcious or hard to communicate, and
         | that's why it matters.
         | 
         | The reason why I use Flutter instead of JS is for a number of
         | reasons beyond perf / native controls. The shortest version is
         | iOS / Safari makes web apps extremely obviously a worse version
         | of a native app.
         | 
         | But I'm picky.
         | 
         | I just upgraded macOS and got a "you must accept new T&C"
         | dialog. Accidentally scrolled on it vertically. It did the
         | rubberband effect showing a white background, and I said to
         | myself: "lo, how the mighty Apple has fallen!"
        
       | FlyingSnake wrote:
       | Powered by NativeScript
       | 
       | Hell no. It's better to stick with RN if you want cross platform.
       | Writing an app in Kotlin and Swift is easier compared to this
       | contraption.
        
       | iamandoni wrote:
       | An alternative I've been enjoying is @tommertom's Ionic port (+
       | Capacitor) for native integration:
       | https://github.com/Tommertom/svelte-ionic-app
        
       | imgabe wrote:
       | I've done a couple React Native apps and never again. They're
       | fine at first but if you let one sit for a few months there is a
       | combinatorial explosion of complexity among shifting
       | incompatibilities of different versions of javascript libraries,
       | the framework, android/iOS versions, build systems, etc. it
       | becomes a nightmare. I'd much rather just learn Kotlin/Swift and
       | have only one ecosystem to maintain.
        
         | wharvle wrote:
         | At the time I used it, it was _almost_ worth it just to use RN
         | for Android even if you did iOS in Swift, just because styling
         | on Android was so hellish ( "There must be some non-crazy way
         | to set a default typeface for my app. Right?" LOL wrong;
         | "setting this color on this Material input field must be easy"
         | LOL nope, welcome to Java metaprogramming just to set a goddamn
         | color), the documentation-suggested way to structure apps was
         | so bad that you'd be reaching for other solutions anyway if you
         | valued your sanity (I wanna say Square was at the forefront,
         | here? It was some company like that. Like your best bet was
         | just to find their libraries and blog posts and do exactly what
         | they did, ignore the official docs), and in some cases the
         | native libraries _for Google APIs_ were less-capable than the
         | Javascript ones anyway (Maps was one, I remember--god, what a
         | surprise that was to find out).
         | 
         | But that was like 5 years ago so maybe it's gotten better.
        
           | rareitem wrote:
           | I agree with you. RN still sucks on some aspects, but it's
           | quite an amazing technology and I'm grateful it exists.
        
             | fakedang wrote:
             | Nah, among cross-platform, RN has stagnated while Flutter
             | has sped past.
             | 
             | The key issue I see these days is that it's just not worth
             | it to build a mobile app these days unless your payment
             | flow happens outside of the app.
        
         | jd3 wrote:
         | We recently threw out our React Native app and have gone all in
         | on PWAs.
        
         | conradfr wrote:
         | People should just Ionic & Capacitor.
         | 
         | You can still use your React knowledge with it.
        
       ___________________________________________________________________
       (page generated 2024-01-29 23:00 UTC)