Views within ZStack are rendered back-to-front, with the first view being placed at the back
use fixedSize()
to neglect the view size proposed to a view by its parent
HStack {
Button(action: {}) { Text("Cancel").fixedSize() }
.padding().frame(maxWidth: .infinity)
Divider()
Button(action: {}) { Text("Delete").fixedSize() }
.padding().frame(maxWidth: .infinity)
}.fixedSize(horizontal: false, vertical: true)
Navigate to Assets.xcassets
in your project folder
Right click into the panel to the left and select New Color Set
https://betterprogramming.pub/custom-colors-and-modifiers-in-swiftui-a093c243c126
lazy var
(cannot belet
)- enables just-in-time calculation when variable is actually needed
struct Person {
lazy var fibonacciOfAge: Int = { // need to declare data type upfront (since value is created by evaluation)
fibonacci(of: self.age) // use self inside function block
}() // call function via ()
func fibonacci(of num: Int) -> Int {...}
}
https://www.hackingwithswift.com/example-code/language/what-are-lazy-variables
on macOS we need to override loadView to prevent error:
"-[NSNib _initWithNibNamed:bundle:options:] could not load the nibName"
this is due to the default implementation of NSViewController's loadView()
ref: https://sarunw.com/posts/how-to-initialize-nsviewcontroller-programmatically-without-nib/