Alerts | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/15234721-your-second-ios-and-swiftui-app/lessons/13

Hi Jessy,

I was stuck by a concept below. Can you explain the two “.init” here?
I check the developer documentation, the first one seems to be related to Alert?
And the other is more like a String initializer? (I have no idea about that)

.alert(isPresented: .constant(true)) {
.init(
title: .init(“Delete image for (book.title)?”),
primaryButton: .destructive(.init(“Delete”)) {
image = nil
},
secondaryButton: .cancel())
}