Hacker News new | ask | show | jobs
by developer2 1832 days ago
I tried to get into it recently, and I couldn't even manage a "hello world" app. The built-in demo/skeleton app creates a text label in code, and that's it. I couldn't even figure out how to get what is now called the "design canvas" to appear; ie. to create a UI visually. I feel like the introduction to Xcode in 2021 is much worse than Visual Basic 6 was 20 years ago. :'(
1 comments

There is no way to create the UI visually in SwiftUI, only programmatically. I find SwiftUI substantially easier to write than Swift or Objective-C, and feel like it actually requires less use of Xcode's functionality than either of its predecessors.
Hmm? From https://developer.apple.com/xcode/swiftui/ :

> Xcode includes intuitive design tools that make building interfaces with SwiftUI as easy as dragging and dropping. As you work in the design canvas, everything you edit is completely in sync with the code in the adjoining editor. Code is instantly visible as a preview as you type, and any change you make to that preview immediately appears in your code. Xcode recompiles your changes instantly and inserts them into a running version of your app — visible, and editable at all times.

Aha, what I was looking for was the "Library" popup, which allows drag-and-drop of new components onto the canvas. Now I understand; this latest iteration of Xcode has the code <-> canvas being bidirectional, so using the library or canvas inspector just edits your code anyway! Interesting. I'll have to run through some docs and tutorials to see if I can finally pick up macOS/iOS app development.