Skip to content

Coupon

NITCoupon has the following getters and attributes:

  • title returns the coupon title
  • couponDescription returns the description
  • value returns the value string
  • expires returns the expiring date
  • redeemable returns the redeemable date, it's a start date of when you can reedem the coupon
  • icon returns an NITImage object containing the source links for the icon
  • serial returns the serial code of the single coupon as a string
  • claimed returns the claimed date
  • redeemed returns the redeemed date

Basic example

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

let vc = NITCouponViewController(coupon: coupon)
vc.show()
NITCouponViewController *vc = [[NITCouponViewController alloc] initWithCoupon:coupon];
[vc show];

where, coupon is an instance of NearIT SDK NITCoupon class.

Coupon Valid Coupon Disabled Coupon Expired

Advanced examples

NearIT-UI is shipped with an icon placeholder. If you need to replace it just set it this way:

vc.iconPlaceholder = UIImage(named: "myCouponPlaceholder")
vc.iconPlaceholder = [UIImage imageNamed:@"myCouponPlaceholder"];

Please, keep in mind that the icon should be a square: a different aspect-ratio can potentially break the layout.

Optionally, you can display the coupon in your UINavigationController:

let vc = NITCouponViewController(coupon: coupon)
vc.show(navigationController: navigationController!, /*optional*/ title: "my coupon")
NITCouponViewController *vc = [[NITCouponViewController alloc] initWithCoupon:coupon];
[vc showWithNavigationController:navigationController];
// or
[vc showWithNavigationController:navigationController title:@"my coupon"];

UI Customization

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

let vc = NITCouponViewController(coupon: coupon)
vc.separatorImage = UIImage(named: "Line")
vc.separatorBackgroundColor = .white
vc.couponValidColor = .black
vc.validFont = UIFont.systemFont(ofSize: 18.0)
vc.fromToFont = UIFont.systemFont(ofSize: 22.0)
vc.descriptionFont = UIFont.boldSystemFont(ofSize: 25.0)
vc.valueFont = UIFont.italicSystemFont(ofSize: 25.0)
vc.valueColor = .purple
vc.iconPlaceholder = UIImage(named: "MyPlaceHolder")
vc.show(fromViewController: nil) { (dialogController: NITDialogController) in
    dialogController.backgroundStyle = .blur
}
NITCouponViewController *vc = [[NITCouponViewController alloc] initWithCoupon:coupon];
vc.separatorImage = [UIImage imageNamed:@"Line"];
vc.separatorBackgroundColor = [UIColor whiteColor];
vc.couponValidColor = [UIColor blackColor];
vc.validFont = [UIFont systemFontOfSize:18.0];
vc.fromToFont = [UIFont systemFontOfSize:22.0];
vc.descriptionFont = [UIFont boldSystemFontOfSize:25.0];
vc.valueFont = [UIFont italicSystemFontOfSize:25.0];
vc.valueColor = [UIColor purpleColor];
vc.iconPlaceholder = [UIImage imageNamed:@"MyPlaceholder"];
[vc showFromViewController:nil configureDialog:^(NITDialogController * _Nonnull dialogController) {
    dialogController.backgroundStyle = CFAlertControllerBackgroundStyleBlur;
}];