AIUserFeedback

public struct AIUserFeedback
extension AIUserFeedback: View
extension AIUserFeedback: _ViewEmptyChecking

AIUserFeedback is used to display a feedback page with customizable title, description, navigation title, filter form view and key value form view. AIUserFeedback can be presented modally using .sheet, or pushed onto a navigation stack.

Usage

@State var voteState: AIUserFeedbackVoteState = .notDetermined
@State var submitButtonState: AIUserFeedbackSubmitButtonState = .normal
@State var filterFormViewSelectionValue: [Int] = [0]
@State var valueText: String = ""
let valueOptions: [AttributedString] = ["Inaccuraies", "Inappropriate Content", "Security Risks", "Slow Response", "Repetitive or Wordy", "Others"]
let filterFormView = FilterFormView(title: "Select all that apply", isRequired: true, options: valueOptions, errorMessage: nil, isEnabled: true, allowsMultipleSelection: true, allowsEmptySelection: false, value: self.$filterFormViewSelectionValue, buttonSize: .fixed, onValueChange: { value in
   print("FilterFormView value change: \(value)")
})
let keyValueFormView = KeyValueFormView(title: "Additional feedback", text: self.$valueText, placeholder: "Write additional comments here", errorMessage: nil, minTextEditorHeight: 88, maxTextEditorHeight: 200, maxTextLength: 200, hintText: AttributedString("Hint Text"), isCharCountEnabled: true, allowsBeyondLimit: false, isRequired: true)

AIUserFeedback(title: { Title(title: "How was your AI experience?") },
            description: { Text("Please rate your experience to help us improve.") },
            navigationTitle: "Feedback" ,
            filterFormView: filterFormView,
            keyValueFormView: keyValueFormView,
            displayMode: .sheet,
            onCancel: {

            }, onUpVote: {

            }, onDownVote: {

            }, onSubmit: { voteState, feedbacks, additional, submitResult in
                submitResult(true)
            }, voteState: $voteState,
            submitButtonState: $submitButtonState)

### Toggle:

@State var isFeedbackPresented = false
Button {
    isFeedbackPresented.toggle()
} label: {
    Text("Present AI User Feedback")
}
.popover(isPresented: $isFeedbackPresented) {
    AIUserFeedback
}