9 ms·
Tauri Mobile – Develop Mobile Apps with JavaScript and Rust
- bsaul 4y agothe page doesn't provide a really good understanding of what the framework is : is it using native ui components ? which part is for the server, which is for the client, and what does the framework provides in terms of bindings between the two ? etc..
- born-jre 4y agohttps://tauri.app/ https://tauri.app/ it is a wrapper around underlying os webview, basically you load your apps js/page in that webview, if you want to do more native things then you can communicate with that app with ipc (probably tauri_sdk_thing that wraps that ipc ) kinda like electron but donot have to ship chromium browser so less ram usage/ binary size also since it is a warapper around webview not a lib_chrome_libary like in electron so it has less control in some case otherwise pretty great idea
- mellonaut 4y agoIt's safe to assume this page assumes some prior knowledge of Tauri[0] and Vue[1], which would answer your question :) [0] https://tauri.app https://tauri.app [1] https://vuejs.org https://vuejs.org
- deleted 4y ago[deleted]
- maxloh 4y agoIt is something like Cordova?
- nkozyra 4y agoIn the sense that it's a thin wrapper around a basic web app, yeah. Although Cordova is/was aimed more at mobile developers specifically and things like Electron and Tauri generally sell themselves as desktop first. The support for all is technically there for all three (and others, like Capacitor) but there's always a few caveats for each and they're rarely the same.
- eklavya 4y agoWhat is the platform api story (kotlin/Swift ffi) for tauri mobile?
- terhechte 4y agoYou could use Dioxus which is native Rust on Tauri (well, on Wry, but it shares a lot of the platform facilities) https://dioxuslabs.com https://dioxuslabs.com
- eklavya 4y agoI am not sure I understand. How do I call android/ios camera, gallery, permission etc APIs?
- terhechte 4y agoIn that case, you'd see if there're native Rust libraries for this and do that. The Rust in Tauri is native, not compiled to WASM. You can access the whole platform. That said, most of the things you mentioned (iOS camera, permissions) don't have any Rust library to work with. So then it is more work because you need to use the native api via FFI. So yeah, I kinda misunderstood your original question. Possible, yes, but by far not as easy as with other solutions that just allow you to write the required functionality with Swift or Kotlin
- wdb 4y agoSounds like a webview loading a Next.js application wrapped in a Rust binary targeting iOS? For me, it always felt much more difficult to match the native ui behaviours in a web application that it defeats the time won. Especially, when you want to support both Android and iOS.
- DanielHB 4y agothe main advantage vs other webview-wrappers is that technically your native code is crossplatform to Android/Windows/MacOS This is important for a few specific types of applications, for example, my app uses a custom network protocol and it would be nice if I coded it for only one platform while avoiding C++ linker hell in 4 different platforms
- intelVISA 4y agoMight sound wild but network-order bytes are pretty platform agnostic.
- wdb 4y agoNot sure, what you mean, but in a non-webview wrapper application everything but the UI code was already shared between platforms? At least in the apps that I worked on. State machines, fetching logic, app flows etc
- usrusr 4y agoI agree in so far that on mobile, tauri is hardly more than yet another webview based cross platform framework. Perhaps better than others, perhaps worse, who knows. But on desktop, Tauri is a true gamechanger. Enabling apps to build on the system webview instead of shipping a full grown browser with each installation, that's huge. And now Tauri gets "also does mobile, when you need it", this will make it far more attractive. Not only for apps that might have a mobile use case, but also for developers whose skill investment in Tauri becomes a lot more useful if it can also get applied to mobile.
- terhechte 4y agoJust a Brief note about Tauri VS Electron. I've always been a opponent of Electron Apps. Even now, my Slack regularly pauses for seconds I suppose because the Garbage Collector has to do its thing. Lately, however, I've worked on a Mastodon Client written in Dioxus (https://terhech.de/ebou/ https://terhech.de/ebou/). Dioxus runs native Rust code and sends Dom Updates to a Tauri Webview. The difference in Ram and Performance is staggering. Much more lightweight because it uses the System Webview, and much faster because it's not Javascript. I've come to the conclusion that Electron itself is probably fast enough, but its the Javascript that causes it to crawl. (Obviously, my tiny app doesn't compare to Slack, but I've also done some simple-enough Electron Experiments). And it makes sense: WebKit has seen tremendous amounts of investments to make it as fast as possible. CSS can do GPU based transforms, everything is heavily optimised. I'd venture that WebView rendering is just as fast as native (in the general case). What makes Electron slow is Javascript.
- sljsdljfslkj 4y ago> but its the Javascript that causes it to crawl If it's updating a web view then it needs to go through javascript. The fastest rust wasm frameworks are not faster than javascript by any meaningful amount.
- dindresto 4y agoThis is actually wrong in this context. Rust is running natively here (so no WebAssembly), directly manipulating the DOM of the web view without having to go through JavaScript glue code.
- fastball 4y agoHow is Rust manipulating the DOM?
- terhechte 4y agoIt uses IPC to give the WebView patches of what to do. There is a wee bit of JS there that parses the IPC and applies the patch to the DOM. Here's the code: https://github.com/DioxusLabs/dioxus/tree/master/packages/interpreter https://github.com/DioxusLabs/dioxus/tree/master/packages/in...
- zacharachnia 4y ago[flagged]
- paulryanrogers 4y agoWhat about Electron sucks? Is Tauri's sole advantage that it crashes less?
- mourner 4y agoTo people missing the joke, this is a quote from ChatGPT that was asked to comment on Tauri in "Dev Mode", taken from comments here https://news.ycombinator.com/item?id=34972791 https://news.ycombinator.com/item?id=34972791
- gausswho 4y agoWasn't funny the first time and it's not insightful. HN is better without.
- zacharachnia 4y agoLighten up.
- tekkk 4y agoBeen using Dart & Flutter. Kinda leaning towards using plain old HTML & CSS inside a webview instead of learning how to work with mobile-specific widgets. Neither won't beat pure-native but at least I'd be able to make a half-decent app fast with HTML & CSS. Tauri looks enticing from that perspective but idk how polished it is vs Flutter. Oh I'm already using Rust in backend so that wouldn't be a big deal. Wonder how well you're able to do GPU / graphics stuff inside webview though? Is WebGPU supported?
- nicoburns 4y agoYou might want to consider React Native. That way you get native widgets but CSS-style layout so there's not too much to learn.
- yesimahuman 4y agoI’d take a look at Capacitor. I’m biased because I created it but I think it’s fair to say it’s the leading platform for web tech on mobile at the moment.
- eklavya 4y agoI haven't checked it thoroughly but would be grateful if you can share. Can you create a single app for mobile, desktop and web in capacitor?
- yesimahuman 4y ago
- maxloh 4y agoWhat is Tauri's advantages over Cordova? Cordova failed the competition against React Native and Flutter.
- pornel 4y agoCordova assumes you'll write most of the app in JS. Tauri is more like a framework/GUI toolkit for Rust apps.
- nequo 4y agoI was looking at this list of apps that use Tauri and according to GitHub most of them are JS/TS-heavy code bases: https://github.com/tauri-apps/awesome-tauri#apps https://github.com/tauri-apps/awesome-tauri#apps
- usrusr 4y agoIf it's a "better electron" (which I think it is, amongst other things) then it will certainly be used for a lot of "web technology only" apps. There are just so many of them, the other end of the spectrum "rust app with some ui built on html" is extremely rare compared to that. My first contact with a tauri app is cinny desktop (matrix client) and it's an absolute joy to use. The project source is hardly more than a reference to the source of the web version and some configuration files that make a PWA manifest seem elaborate by comparison.
- yesimahuman 4y agoCordova has been superseded by Capacitor for several years now. And web tech on mobile is still wildly popular and isn’t going anywhere. Capacitor and Tauri Mobile are still the only platforms that can offer the value prop of bringing new and existing standard web apps to native mobile, which web developers still very much want to do just like they do on desktop with Electron/Tauri.
- rascul 4y agoIs there a library/framework/toolkit/whatever to make native GUI Android apps in rust? That's what I'm missing. I'm not interested in creating a web app as an Android app. Tauri looks interesting but it's not for me. And that's fine, because there's a whole lot of people who would use it, I'm sure.
- flohofwoe 4y agoThe problem is usually that all the Android APIs are designed for Java/Kotlin and extremely opinionated on top. Using those APIs from other languages is a royal PITA. That's why webview apps are so popular in the first place, because you don't need to deal with the actual Android APIs.
- barakplasma 4y agoI used an Android app called Automate (from llama labs) to add Android notifications and UI around a Rust binary compiled for Android https://github.com/barakplasma/israel-weather-rs#running-on-android-with-help-from-llamalab-automate https://github.com/barakplasma/israel-weather-rs#running-on-...
- pedalpete 4y agoThis is what we are looking for as well. We started using Kotlin Multi-platform (KMM) a little while ago thinking it would be nice to separate build native UI and shared components which drive our logic. Unfortunately, it hasn't worked out that well for us. Devs aren't liking it, and finding that the shareability of code, particularly because of bluetooth, is making things more difficult than it needs to be.
- lucasyvas 4y agoIs the native SDK story with this that you'd be on the hunt for Rust libraries that invoke native mobile functionality? Not sure if there are any well-maintained bindings to those SDKs around, but could be wrong. There are plenty for desktop, but I haven't seen any high quality mobile OS bindings. Otherwise I imagine you could use capacitor from JS? But I see no pitch for how this should be done so far.
- erlend_sh 4y ago> Note: This is based on the 2.0 Alpha version and the early version of the documentation. An updated version of the create-tauri-app utility is in development to make a number of the following steps easier. CTA v3 was released a few hours ago: https://tauri.app/blog/2023/03/01/create-tauri-app-version-3-released/ https://tauri.app/blog/2023/03/01/create-tauri-app-version-3...
- college_physics 4y agoThe fact that many independent cross-platform app frameworks build something around webview suggests there is a baby crying to be born here, but what exactly it will look like is not clear.
- turbobooster 4y agoFlutter has way better support
- capableweb 4y agoUnless you care about accessibility, seems Flutter don't care too much about that, yet at least.
- turbobooster 4y agoWhat do you mean about accessibility?
- FlyingSnake 4y agoIf you’re going to convince mobile developers to use Tauri, at least invest some time in showcasing a good enough example. How do the apps do navigation? How do they store data for offline usage? How about networking? How can I access camera or hardware features? Tauri might be the bees knees and cross platform toolkits are cool but I’m not seeing anything worthwhile in this blogpost.
- bwindels 4y agoI think they'd consider that out of scope, which for me is a feature rather than a bug. The project is really about providing the runtime, rather than batteries-included application framework as many mobile platforms provide. Perhaps they are targeting web/rust developers more than native mobile developers? All the things you would like to see in an example have well-established ways of doing in a web application. Camera access is a good example, where the javascript way of doing is through navigator.getUserMedia(). I imagine it would be supported by Tauri where the underlying browser engine supports it. Tauri provides filesystem access as well, as you don't have that in a web page.
- marcus_cemes 4y agoI decided to use Tauri for the first time for a university project and it was absolutely painless to design a small and useful GUI application to programatically generate schematics for photolithography masks. - Single lightweight binary install and executable (~6 MB), clean uninstall - Automatic updates (digitally signed, uploaded to a small VM) - Integrates nicely with SvelteKit and TailwindCSS - The Rust backend was able to integrate with GTSDK over FFI. The cmake crate made C++ compilation and linking automatic as part of cargo build, provided that a C++ toolchain is available (no problems even on Windows). - No scary toolchain setup with a load of licenses to review and accept (looking at you, Flutter. I'm a student, not a lawyer. Although perhaps this will also be a thing with Tauri + Android?) For a small project, I can't recommend it enough. I wouldn't know where to start with a C# or Qt GUI application, especially if I wanted to make it cross-platform. It'll be interesting to see if it gains any traction in the mobile space. Flutter is great and may be better optimised for certain rendering techniques, such as infinite lists, but sticking with web technologies is a very compelling advantage.
- nwah1 4y ago.NET MAUI is cross-platform and very easy to get started with, but would sacrifice a lot of performance to gain the convenience and simplicity of the development experience.
- naavis 4y agoIt's also no-go for Linux. Otherwise I would be all over it.
- nwah1 4y agoThere is work being done to address desktop linux, but I agree that is one of the deficiencies. https://github.com/jsuarezruiz/maui-linux/pull/37 https://github.com/jsuarezruiz/maui-linux/pull/37 The lack of a WASM target is another, although UNO project in the past provided such a target for MAUI's very closely-related predecessor (Xamarin.Forms). https://platform.uno/xamarin-forms/ https://platform.uno/xamarin-forms/
- penguin_booze 4y agoI'd be interested to know how the non-GUI part of the app would work. Things that are native to Android, like sending notifications, toast, or setting off alarm etc.?
- account-5 4y agoI've said this a number of times but I'll repeat here. I'm new to web development and was completely overwhelmed by the choice of which framework I should learn. I wanted to develop a simple app that needed to run on mobile and desktop, maybe later as a webapp. I learned html/CSS and vanilla JavaScript in the end, but for my app dart/flutter. I gave up on the various frameworks, I still cant decide if one or the other is the one I should be learning, the risk of wasting my time on a soon to be dead framework isn't one I'm willing to take. All that said, for the novice, why would I use this over dart/flutter, or even one of the huge amount of other JavaScript frameworks?
- orthecreedence 4y agoTauri shines when you want to have your business logic written in rust, and/or your app bundled as a desktop application that renders using the platforms built-in browser (meaning, you can use a rust logic core with a web-based UI). For many (including me), this is a winning combination. Granted, you can embed rust in Flutter/Dart as well: https://cjycode.com/flutter_rust_bridge/index.html https://cjycode.com/flutter_rust_bridge/index.html. Effectively, Tauri is like Electron, but bundles the ability to call into Rust land (if you want/need that) and uses the operating system's browser instead of bundling one. The idea is that the apps in Tauri are a lot smaller in mb and use a lot less memory than Electron apps. The con is, of course, you now have to deal with rendering/runtime discrepancies between the different platform browsers. If you're fine with this, and especially if you want to embed rust in your app, go with Tauri. If you want an easier dev experience, don't need to bundle rust (you can but you'll be compiling/loading shared libs), and the bundle size and memory usage isn't a huge concern, go with Electron. As far as Flutter vs Web tech, that's a whole different question. I've used Flutter here and there and liked it (although I hate Dart) but I really question its long-term staying power. I wonder about accessibility too...can anyone who is more familiar with Flutter way in? Google also has a fascination with killing projects, even ones where "they wouldn't possible kill that" so if you have the time/resources, I'd hedge my bets and learn web tech as well...even knowing vanilla JS/HTML/CSS can get you going pretty far. So if you've made a bet on Flutter and put a lot into it, I'd say keep going...I wouldn't change everything just yet. But keep the options open and keep exploring too. As far as web frameworks, I don't think you can go wrong picking one of React, Vue, or Svelte and really investing some time into learning it.
- satvikpendem 4y agoEh, it's still a web view at the end of the day, I'd rather use native, RN or Flutter, and with Flutter I can also use Rust via flutter_rust_bridge. That is in fact what I'm already doing currently with one of my apps.