SwiftUI Programatically?

HI,

My project bypasses storyboards, I like to keep everything in code that I write myself. Can SwiftUI be used this way? Also, how powerful is SwiftUI? Is it just for writing simple user interfaces or can it be used to write highly customized ones that rival a programatic approach?


Thanks


Brian Duffy

Accepted Reply

I'm no expert, but I will try to answer.

  1. SwiftUI uses only source code to describe the UI. No storyboard files.
  2. SwiftUI is similar to other reactive UI frameworks, which are quite powerful.
  3. I think the intent here is to be able to use SwiftUI for all apps. It's pretty cool how you can adopt it piecemeal within your app.


cheers

Replies

I'm no expert, but I will try to answer.

  1. SwiftUI uses only source code to describe the UI. No storyboard files.
  2. SwiftUI is similar to other reactive UI frameworks, which are quite powerful.
  3. I think the intent here is to be able to use SwiftUI for all apps. It's pretty cool how you can adopt it piecemeal within your app.


cheers

It's all programmatically. It looks like Adobe Dreamweaver WYSIWYG editor from 20 years ago is now in Xcode. Apply UI in the canvas and it instantly generates code for you, though how much you can control is a ?, how well it does what you want remains to be seen.


This is kind of concerning to me, as it seems to make controlling the layout precisely difficult. One of the great advantages of xibs is that the UI you layout in IB is just data, not code. You can use multiple xibs with different UIs that share the same controller (when it makes sense). Bringing this "web" style of development to native apps is not very appealing to me. But I'll give it a shot, at some point.