36 comments

[ 2.6 ms ] story [ 49.9 ms ] thread
> Valdi is a cross-platform UI framework that delivers native performance without sacrificing developer velocity. Write your UI once in declarative TypeScript, and it compiles directly to native views on iOS, Android, and macOS—no web views, no JavaScript bridges.
I was at Snap during this project’s early days (Screenshop!) and spent a bit of time debugging some stuff directly with Simon. He’s a wonderful engineer and I’m thrilled to see this project out in the open. Congratulations Snap team! Well deserved.
I’m not sure I trust snap of all companies to make a good cross platform framework after how terrible their android app has been.
This looks promising. I would love to see more examples of what this can do along with screenshots. As is, there is a single Hello World and the components library is “coming soon”. But if it can deliver what it promises that would be pretty cool. React Native is I think the main popular framework in this space.
So this is like all those other frameworks that compile to native components, except this one is natively Typescript?

I’ll take it

Not to troll , Do you need such shims in the era of llm ?
So now I can finally implement the most god-awful, ugly, cumbersome and unintuitive GUI methodology ever to face a large population of users into my own apps? This abomination that started the whole user-experience decline by making this kind of yuck the gold standard for apps today is finally open source?

Color me yellow.

I wish the native iOS part was written in Swift rather than Objective-C like RN.
Working at a company that uses react-native I wish nothing more than for the end of app stores and differing platform languages.

We're heavily considering just having a website next year with a mobile app using webview, and then native code for the native notifications, GPS and healthkit / health connect.

I feel like AI is changing the equation, its nearly better to write your business UI 3 times one for each platform.

I started with desktop applications, so my go-to for GUI has been Qt, especially QML. It works on Windows / MacOS / Linux as well as iOS and Android. I think there’s now a way to compile QML to webassembly as well. It also has a ton of support classes that are loosely analogous to the various *Kit things supplied on iOS and Android.

The downside is that the core of Qt is in C++, so it’s mostly seen (or used for?) embedded contexts.

I recently used Slint as well, which isn’t anywhere near as mature, but is at least written in Rust and has some type-safety benefits.

SwiftUI is pretty good too, and I wish I got to work on Apple platforms more.

To me, the simplicity of creating a “Button” when you want a button makes more sense, instead of a React component that’s a div styled by layers of CSS and brought to life by JavaScript.

But I’m kind of bummed that I started with that route (well, and writing partial UI systems for game / media engines a few times) because most people learned web apps and the DOM, and it’s made it harder to get the kind of work I identify with.

So it’s hard for me to recommend Qt due to the career implications…but at the same for the projects I’ve worked on, it’s made a smaller amount of work go a longer way with a more native feel than electron apps seem to have.

Not related to this, but abandoning Key DB was the worst thing they could do.
This is so cool! I'm a React-Native developer, and I'm glad to see more options like this coming into existence.
Its hard to imagine not going fully native in the modern day with coding agents. Most of the code can just be clanked out.
If you are curious how components' state is handled, they employed the React class components method:

  // Import the StatefulComponent
  import { StatefulComponent } from 'valdi_core/src/Component';
  
  // ViewModel + State interfaces for component
  export interface TimerViewModel { loop: number }
  interface TimerState { elapsed: number }
  
  // Component class
  export class Timer extends StatefulComponent<TimerViewModel, TimerState> {
    // Initialize the state
    state = { elapsed: 0 };
    // When creating the component, start a periodic logic
    private interval?: number;
  
    // Initialize the setInterval that will update state once a second incrementing
    // the `elapsed` state value.
    onCreate() {
      this.interval = setInterval(() => {
        // Increment the state to trigger a re-render periodically
        const elapsed = this.state.elapsed;
        const loop = this.viewModel.loop;
        this.setState({ elapsed: (elapsed + 1) % loop });
      }, 1000);
    }
  
    // When component is removed, make sure to cleanup interval logic
    onDestroy() {
      if (this.interval) clearInterval(this.interval);
    }
  
    // Render visuals will depend both on the state and the view model
    onRender() {
      <view padding={30} backgroundColor='lightblue'>
        <label value={`Time Elapsed: ${this.state.elapsed} seconds`} />;
        <label value={`Time Looping every: ${this.viewModel.loop} seconds`} />;
      </view>;
    }
  }
https://github.com/Snapchat/Valdi/blob/main/docs/docs/core-s...
I often wonder how the economics are justified in making in house frameworks. What is it about Snapchat that requires a new framework but not other apps?
I cannot possibly think of something I would want to use less. A Snapchat-developed UI framework where communication is done via Discord sounds like something carefully designed to repulse me.
Ah yes, Snapchat, an app famous for its high performance, efficient apps, which definitely never made your phone hot and drained your battery.

Seriously, if there’s an app that sticks in my head for being noticeably laggy, you couldn’t pick a better example than Snapchat.

> Valdi – A cross-platform UI framework

I presume this is a Text UI. How does it compares with ncurses and termcap ? /s

Unfortunately no Linux, Windows or even HTML targets?
Just write 2 native UIs in the 2 platform native languages and share a common core written in any language that offers a C like FFI.

How hard could it be?

I hear this and it makes sense but when I actually go about implementing it, it quickly falls apart.

Most apps are UI, remote requests and maybe some storage. What do you put in the common core? Android does HTTP requests one way. iOS does them another way. You go for the lowest common denominator an implement a third way, using libcurl or something?

Or do you just put business logic in the common core? Is there really that much business logic that doesn't issue requests or access a database?

Looks in concept very similar to React Native. So now we have React Native, Lynx.js (ByteDance/Tiktok) and Valdi all based on React. I think competition is good for devs. But not sure if any of those will create ecosystem and community big enough and fast enough to React Native.

React Native grew a lot this year and a lot of things got or will be improved and copied from Lynx or Valid:

- 3 modes of compilation (AOT, JIT) from Valdi will be in static hermes (RN) in coming months.

- native binding generation -> RN already have such official generator and also nitro/nitrogen, they also working on Node-API

- executing animation and JS code in different thread (Lynx.js) -> worklet library in RN from swmansion

- tailwindcss support (Lynx) -> uniwind in RN land.

I think Lynx.js maybe have better shot at React Native since they want to support other frameworks instead of only React.

Is there an AI agent that excels that translating UI codes between SwiftUI, Jetpack Compose and web?
(comment deleted)
I looked at the source code (as an amateur application developer) and boy, is it over-engineered and complex! Then I remember having built a complex Cordova app more than a decade ago, where I had to make C++, JNI and Javascript interop all play nice and this project feels a lot like that. Lots of moving parts. I suppose this is just the way things are when you are targetting such different ecosystems as Android and iOS _natively_, at the lowest level.

As a solo-dev, I realize well that this project isn't for me. This could be a great tool for experienced folks who know what they are doing. I will stick to Tauri and React Native, it does 80% of what I care about with 20% of the effort. Or until someone builds a nice wrapper around this to make it easy to use (and also add targets for x86_64/aarch64 builds).

As an amateur, how can you tell that's it's overly complex? Do you understand what you're even looking at? Or do you feel that you should be able to understand it and anything above your ability to understand is "over engineered?" This seems like the Dunning-Kruger effect more than anything else.