Live data from Hacker News

Integrating Zig and SwiftUI

mitchellh.com

1–10 of 58 posts

Re: Integrating Zig and SwiftUI

#2
Rust also works quite well from Swift, in the same way

The key to a nice developer experience is making the build from source flow as easy/integrated as possible

I use a build script in Xcode to build a Rust static library automatically when building an app. This is the latest version in a project I am helping with: https://github.com/hackclub/burrow/blob/main/Apple/NetworkEx...

It would be cool to write a similar adapter but to run build.zig!

Re: Integrating Zig and SwiftUI

#4
SwiftUI shines because you get to write Swift code and embrace the DSL

You'll never be able to write that kind of code with Zig, or C or C++, it's impossible: https://github.com/amosgyamfi/open-swiftui-animations

So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application, and that does look interesting, so you could write your crossplatform app logic in Zig, and only use Swift the UI

That's the advantage that should be advertised, Kotlin tried with Kotlin-Native, seems like a good strategy

Re: Integrating Zig and SwiftUI

#5

SwiftUI shines because you get to write Swift code and embrace the DSL You'll never be able to write that kind of code with Zig, or C or C++, it's impossible: https://github.com/amosgyamfi/open-swiftui-animations So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application, and that does look interesting, so you could write your crossplatform app logic in Zig, and only…

Second paragraph in OP:

> One approach to building a native GUI for a cross-platform application is to write all of the business logic in a cross-platform language (C, Rust, Zig, etc.) and then write the platform-specific GUI code. This is the approach I take with my my terminal emulator and it works really well. As of the current date writing this post, 93% of my repository is business logic in Zig and C, and 4% is macOS-specific GUI code in Swift.

Re: Integrating Zig and SwiftUI

#6

SwiftUI shines because you get to write Swift code and embrace the DSL You'll never be able to write that kind of code with Zig, or C or C++, it's impossible: https://github.com/amosgyamfi/open-swiftui-animations So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application, and that does look interesting, so you could write your crossplatform app logic in Zig, and only…

Are you suggesting that Zig never lets you just think about the problem? That's some terrible preoccupation with an idealized concept of a DSL.

The swift code examples look kinda slick but it isn't a different paradigm any more than JSX is for building HTML.

It seems like a form of The Bipolar Lisp Programmer. https://www.marktarver.com/bipolar.html

> Lisp is like wielding an air gun with power and precision.

Those Swift examples you show are very exciting, but it's best not to get carried away. It's the same as those that say that vim is terrible because it's modal and don't believe that vim programmers can think about the problem while they're typing because their brain is distracted with switching between modes.

Re: Integrating Zig and SwiftUI

#7

SwiftUI shines because you get to write Swift code and embrace the DSL You'll never be able to write that kind of code with Zig, or C or C++, it's impossible: https://github.com/amosgyamfi/open-swiftui-animations So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application, and that does look interesting, so you could write your crossplatform app logic in Zig, and only…

>"So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application"

I've heard that BS from MS reps when they visited our company sometime in 90s. They were telling us how we should have monkeys drawing forms in VB and gurus making main code in C/C++. Then I showed them Delphi. You had to see how sour their faces turned.

>"You'll never be able to write that kind of code with Zig, or C or C++"

Your statement looks totally wrong. Looking at code seems like simple "fluent" notation that is quite possible in languages you mentioned.

Re: Integrating Zig and SwiftUI

#8
post #7

SwiftUI shines because you get to write Swift code and embrace the DSL You'll never be able to write that kind of code with Zig, or C or C++, it's impossible: https://github.com/amosgyamfi/open-swiftui-animations So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application, and that does look interesting, so you could write your crossplatform app logic in Zig, and only…

>"So the main advantage here would be to be able to consume your Zig code/libraries with your Swift application" I've heard that BS from MS reps when they visited our company sometime in 90s. They were telling us how we should have monkeys drawing forms in VB and gurus making main code in C/C++. Then I showed them Delphi. You had to see how sour their faces turned. >"You'll never be able to write that kind of code wi…

[deleted]

Re: Integrating Zig and SwiftUI

#10
post #2

Rust also works quite well from Swift, in the same way The key to a nice developer experience is making the build from source flow as easy/integrated as possible I use a build script in Xcode to build a Rust static library automatically when building an app. This is the latest version in a project I am helping with: https://github.com/hackclub/burrow/blob/main/Apple/NetworkEx... It would be cool to write a similar ad…

the key to 90% programmer is though, zig seems to be 100 times easier to master.

to me, use zig for c,use rust for c++

Post reply on HN