Skip to content

Feedback Request

NITFeedback is the object that represents a Feedback request, with the following getters and fields:

  • question returns the feedback request string
  • trackingInfo returns tracking information linked to the feedback delivery

To give a feedback call this method:

// rating must be an integer between 1 and 5, and you can set a comment string.
let feedbackEvent = NITFeedbackEvent(feedback: feedback, rating: 5, comment: "Awesome")
manager.sendEvent(feedbackEvent, completionHandler: { (error) in
    //
})
// rating must be an integer between 1 and 5, and you can set a comment string.
NITFeedbackEvent *event = [[NITFeedbackEvent alloc] initWithFeedback:feedback rating:5 comment:@"Awesome"];
[manager sendEventWithEvent:event completionHandler:^(NSError * _Nullable error) {
    //
}];

Basic example

If you want your app to display a feedback request in a beautiful pop-up dialog, use this simple code:

let vc = NITFeedbackViewController(feedback: feedback)
vc.show()
NITFeedbackViewController *vc = [[NITFeedbackViewController alloc] initWithFeedback:feedback];
[vc show];

where, feedback is an instance of NearIT SDK Feedback class.

The Feedback UI also takes care of delivering the user response to the SDK library and showing the proper success or failure status of the user action.

Example

Advanced examples

If you want, you can disable comments entirely and only ask for a star number rating (please note that the text response is always optional):

let vc = NITFeedbackViewController(feedback: feedback)
vc.commentVisibility = .hidden
NITFeedbackViewController *vc = [[NITFeedbackViewController alloc] initWithFeedback:feedback];
vc.commentVisibility = NITFeedbackCommentVisibilityHidden;

UI Customization

Some aspect of the UI can be customized with these methods:

let vc = NITFeedbackViewController(feedback: feedback)
vc.sendButton = UIImage(named: "my_button")
vc.commentDescriptionText = "Do you want to share your opinion?"
vc.closeText = "Not interesting"
vc.sendText = "Rate"
vc.textColor = UIColor.black
vc.okText = "Thanks for sharing your opinion!"
vc.textFont = UIFont.boldSystemFont(ofSize: 15.0)
vc.errorFont = UIFont.boldSystemFont(ofSize: 20.0)
vc.show(fromViewController: nil) { (dialogController: NITDialogController) in
    dialogController.backgroundStyle = .blur
}
NITFeedbackViewController *vc = [[NITFeedbackViewController alloc] initWithFeedback:feedback];
vc.sendButton = [UIImage imageNamed: @"my_button"];
vc.commentDescriptionText = @"Do you want to share your opinion?";
vc.closeText = @"Not interesting";
vc.sendText = @"Rate";
vc.textColor = [UIColor blackColor];
vc.okText = @"Thanks for sharing your opinion!";
vc.textFont = [UIFont boldSystemFontOfSize:15.0];
vc.errorFont = [UIFont boldSystemFontOfSize:20.0];
[vc showFromViewController:nil configureDialog:^(NITDialogController *dialog) {
    dialog.backgroundStyle = CFAlertControllerBackgroundStyleBlur;
}];