Your First iOS & SwiftUI App: An App from Scratch, Episode 4: SwiftUI Views | Kodeco, the new raywenderlich.com

Learn how to create user interfaces in SwiftUI by constructing a tree of Views, such as Text, Slider and Button.


This is a companion discussion topic for the original entry at https://www.kodeco.com/28797163-your-first-ios-swiftui-app-an-app-from-scratch/lessons/4

With Xcode 14.2, showing a horizontal orientation in preview doesn’t work using .previewLayout. It does work using the modifier:

.previewInterfaceOrientation(.landscapeRight)
1 Like

At 10:49 in the video we add our first button. It seems the button code has changed in Xcode 14.2. It now is:

            Button("Hit me") {
            }

At 12:17 the way that Xcode 14.2 seems to have also changed. Now it seems you have to manually work with the following controls highlighted in red:

Or click that second little button at the bottom of the preview area called “Selectable”, which is not the default, which then seems to make Xcode behave like in Ray’s video.

Hope this doesn’t confuse too many newcomers!