Files
purchases-ios/RevenueCatUI/CustomerCenter/Views/UIKit Compatibility/CustomerCenterViewController.swift
T

56 lines
2.0 KiB
Swift

//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// CustomerCenterViewController.swift
//
// Created by Will Taylor on 12/6/24.
import RevenueCat
import SwiftUI
#if canImport(UIKit) && os(iOS)
/// Use the Customer Center in your app to help your customers manage common support tasks.
///
/// Customer Center is a self-service UI that can be added to your app to help
/// your customers manage their subscriptions on their own. With it, you can prevent
/// churn with pre-emptive promotional offers, capture actionable customer data with
/// exit feedback prompts, and lower support volumes for common inquiries — all
/// without any help from your support team.
///
/// The `CustomerCenterViewController` can be used to integrate the Customer Center directly in your app with UIKit.
///
/// For more information, see the [Customer Center docs](https://www.revenuecat.com/docs/tools/customer-center).
@available(iOS 15.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
public class CustomerCenterViewController: UIHostingController<CustomerCenterView> {
/// Create a view controller to handle common customer support tasks
/// - Parameters:
/// - customerCenterActionHandler: An optional `CustomerCenterActionHandler` to handle actions
/// from the Customer Center.
public init(
customerCenterActionHandler: CustomerCenterActionHandler? = nil
) {
let view = CustomerCenterView(
customerCenterActionHandler: customerCenterActionHandler
)
super.init(rootView: view)
}
@available(*, unavailable, message: "Use init(customerCenterActionHandler:mode:) instead.")
required dynamic init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
#endif