DEV Community

Wes Souza
Wes Souza

Posted on

Web developers: with SwiftUI, would you consider learning Swift?

Apple just announced SwiftUI, a "simple way to build user interfaces across all Apple platforms with the power of Swift".

It's a declarative way to create native views. It's very similar to component systems such as React and Flutter.

Swift UI code example

Are you curious about it? Would you consider jumping into native development?

What if they release a version for the web?

Edit: Changed title to reflect "learning Swift" instead of moving to Apple's iOS platform. Cross-platform is also diversity.

Top comments (20)

Collapse
 
steveblue profile image
Stephen Belovarich • Edited

I'm primarily a web developer and been itching to learn another language. Swift has looked appealing for quite some time, but WWDC 19 convinced me to finally drop everything and start learning it.

I spent an evening watching talks and messing around with SwiftUI and Combine. It has prompted me to try and prototype a MacOS app I have wanted to build for some time. I may write a post about it.

Honestly, its kinda a tough sell for existing app developers. SwiftUI will only work in Catalina and above so managing compatibility between versions would be nightmarish I think without a solid migration strategy.

Collapse
 
smlarkin profile image
Shawn Michael Larkin • Edited

Doesn't anyone see the potential for a cross-compiler to emerge for Swift UI?

Scade.io already does something like this, but something new will probably come out. Basically, you write your app interface in Swift UI and then export/import your package into another tool which will spit out an Android bundle and, perhaps, a web bundle (like Flutter).

I am also curious to know if Apple will consider outputting to the Web, like Flutter, but I doubt it. Although, I'm sure someone will make this happen.

Collapse
 
wes profile image
Wes Souza

That's my biggest hope.

Collapse
 
smlarkin profile image
Shawn Michael Larkin • Edited

The more I think about this, the more it makes sense. You would have a tool that imports the Swift UI project, then gives you options for other non-Apple targets. For the web, you are previewed the tag conversions, which you can adjust, and for Android you see the design tweaks too. You can edit and optimize inside this tool and then hit "compile" and you now have these perfect production bundles ready to deploy.

So it'a almost like a dedicated IDE for compiling to non-Apple devices, where you get the maximum control leaving Swift UI.

Yeah, someone should make that :)

Collapse
 
stolinski profile image
Scott Tolinski

Why not focus on something cross platform instead?

Collapse
 
maeganwilson_ profile image
Maegan Wilson

SwiftUI would cover all the Apple OSes: iOS, iPadOS, and macOS. My brief experience with something like React Native or other cross-platform is that I still need to know the native language at least a little bit, so I would think that it is still worth learning at least the basics of where Apple is going.

Collapse
 
stolinski profile image
Scott Tolinski

I didn't find that to be the case with React Native in small to medium sized projects, so I personally wouldn't invest too much time into something that keeps you in only Apple's world, but I can def understand why it's appealing to iOS devs. IMO (and I know others might disagree), you shouldn't be building for JUST iOS in 2019 when on the web we always want to support as many users as possible.

Thread Thread
 
maeganwilson_ profile image
Maegan Wilson

I think being cross platform is the way forward for companies.

I think there is value in having knowledge of how to program for the native platform is good as well.

Collapse
 
wes profile image
Wes Souza

Can you name some examples?

I'm also curious to see this thing ported to the web, maybe with WebAssembly even.

Collapse
 
stolinski profile image
Scott Tolinski

React Native or Flutter. If you are coming from the web and learn SwiftUI you are stuck in iOS land. RN & Flutter and you can build for Android as well.

Thread Thread
 
wes profile image
Wes Souza

You're right, I guess "move to native development" is the wrong term here, since it's applecentric.

I've been doing React Native for a while at my current job, but got really curious to see where Apple is going with this. But of course it alienates the process to iOS.

Thread Thread
 
stolinski profile image
Scott Tolinski

Right. I just can't imagine ignoring a platform as large as Android as a dev. That would be a like building an web app and not having it work for half of Chrome users.

Thread Thread
 
wes profile image
Wes Souza

Edited the title :)

Collapse
 
alexsasharegan profile image
Alex Regan

The announcement of SwiftUI was sufficiently familiar to my world of front-end frameworks for me to get really excited about building with it. I intend to jump in at the general availability release, but I'm watching tutorials from beta users for now to get familiar with workflow.

Collapse
 
wheelhot profile image
Omar Tan

Well with the logic of how SwiftUI preview works, I wonder if it can be ported for the web as it really feels like a great flexible interface builder to be honest. And since it just use declarative and modifiers, can't underneath the modifier something like javascript be used instead when porting to the web? Just curious

On the other note and I know it's highly unlikely, is it even possible to port Swift to the web?

Collapse
 
wes profile image
Wes Souza • Edited

I am very intrigued myself. Will definitely play with it this coming weekend.

Collapse
 
robrecord profile image
Record

I also am intrigued. I have an upcoming React Native project and hearing about SwiftUI really made me question my choice of framework. Sounds like their roads (Swift & React) might be converging, or at least coming close enough to help us all out.

Collapse
 
theodesp profile image
Theofanis Despoudis

Too early to make decisions. Letโ€™s see how it will go

Collapse
 
elalecs profile image
ElAlecs

What could happen if Apple or the community create a Web SDK of SwiftUI?

Collapse
 
ymiyugy profile image
YmiYugy • Edited

I don't see Apple having any incentive doing that and why would it's community do it, most of whom probably develop Apple only if there are things like Flutter out there?
But even if they did you would still be stuck with XCode or have far worse tooling.