The Feedback view will be in charge of rendering different types of feedbacks. Its content is customisable while the appearance is automatically configured per brand based on the selected feedback style. Background color, icon, animations, fonts and colors are predefined and can't be changed.
With trailing closure syntax:
Feedback(
style: .informative,
title: "Title",
message: "Message"
) {
Text("This extra view is optional")
} primaryButton: {
Button("Primary") {}
} secondaryButton: {
Button("Secondary") {}
} linkButton: {
Button("Link") {}
}
Multiline strings that will be positioned one below the other. If the content is large enough the view will scroll.
There are three fixed styles available: .success
, .informative
and .error
. There's one custom style .feedback(image)
that can be used to provide an icon that will be used instead of the fixed ones:
Success | Informative | Error | Feedback |
---|---|---|---|
For the primary action, a Feedback with a single primary button can be created:
Feedback(
style: .success,
title: "Title",
message: "Message",
primaryButton: {
Button("Primary") {}
}
)
For the secondary action, a Feedback with a single secondary button can be created:
Feedback(
style: .success,
title: "Title",
message: "Message",
secondaryButton: {
Button("Secondary") {}
}
)
For the link action, a Feedback with a single link button can be created:
Feedback(
style: .success,
title: "Title",
message: "Message",
linkButton: {
Button("Link") {}
}
)
You can have other combinations with primary, secondary and link buttons so please explore the available initialisers.
An extra View
can be provided to be placed below the subtitle. It will keep the same margins than the view above so no constraints should be required in order to properly align it with the rest of the content.