How to print() to Xcode console in SwiftUI?

You can easily add a print statement anywhere in a function builder by simply storing its return value in a wildcard, effectively ignoring it: let _ = print(“hi!”) No setup or other verbosity needed! Why does this work while a regular print() doesn’t? The way SwiftUI’s @ViewBuilder (and result builders in general) is that they … Read more

SwiftUI @State var initialization issue

SwiftUI doesn’t allow you to change @State in the initializer but you can initialize it. Remove the default value and use _fullText to set @State directly instead of going through the property wrapper accessor. @State var fullText: String // No default value of “” init(letter: String) { _fullText = State(initialValue: list[letter]!) }

Activity indicator in SwiftUI

As of Xcode 12 beta (iOS 14), a new view called ProgressView is available to developers, and that can display both determinate and indeterminate progress. Its style defaults to CircularProgressViewStyle, which is exactly what we’re looking for. var body: some View { VStack { ProgressView() // and if you want to be explicit / future-proof… … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)