NeoDay iOS SDK - Coupons
/// Makes the Coupons Overview screen that shows all the Coupons available for a user.
///
/// - parameter completion: Contains the screen with all the Coupons.
public func makeCouponsOverview(
_ completion: @escaping (Result<UIViewController, Error>) -> Void
)
/// Makes the Coupon detail screen based on the couponSlipID.
///
/// - parameter couponSlipID: The id of the CouponSlip.
/// - parameter completion: Returns the Coupon Detail screen or an Error.
public func makeCouponDetail(
couponSlipID: String,
_ completion: @escaping (Result<UIViewController, Error>) -> Void
)
Directly requesting a Coupon Overview screen
The NeoDaySDK factory methods are executed asynchronously in order to fetch the data and return a UIViewController.
sdk.makeCouponsOverview { [weak self] result in
guard let self = self else {
return
}
switch result {
case let .success(viewController):
// Display the viewController
case let .failure(error):
// Handle the error
}
}
Directly requesting a Coupon detail screen
sdk.makeCouponDetail(couponSlipID: "coupon-slip-id") { [weak self] result in
guard let self = self else {
return
}
switch result {
case let .success(viewController):
// Display the viewController
case let .failure(error):
// Handle the error
}
}