Cannot find CustomerCenterView importing RevenuecatUI
- [x] I have updated Purchases SDK to the latest version
- [x] I have read the Contribution Guidelines
- [x] I have searched the Community
- [x] I have read docs.revenuecat.com
- [x] I have searched for existing Github issues
Describe the bug
We have been approved to use this alpha feature.
- Environment
- Platform:
- SDK version:
- StoreKit version:
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
.with(storeKitVersion: .storeKit1)) - [x] StoreKit 2 (default on versions >=5.0.0)
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
- OS version: any
- Xcode version: 15.2
- Device and/or simulator:
- [x] Device
- [x] Simulator
- Environment:
- [x] Sandbox
- [ ] TestFlight
- [ ] Production
- How widespread is the issue. Percentage of devices affected. 100%
- Debug logs that reproduce the issue. Complete logs with
Purchases.logLevel = .verbosewill help us debug this issue.
Logs here
- Steps to reproduce, with a description of expected vs. actual behavior
Download the latest revenucatui xcframework from tags. include it in your target, try to use CustomerCenterView.
-
Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
-
Additional context Add any other context about the problem here.
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
With SPM the file is available but all related to customer center is surrounded by a directive. Is there any way to build it including the directive anywhere?. I've included in my target but doesn't work. I had to modify each file to remove the compiler directive.
@jesus-mg-ios we are just about to make a public beta that removes the directive and will solve this issues you're seeing
https://github.com/RevenueCat/purchases-ios/pull/4308
@vegaro we were granted the alpha preview and we are trying to use it, but not sure how
@jesus-mg-ios @unxavi we are having some issues with the release of purchases-ios 5.5.0 so we are holding the public beta until next week
That means that if you want to test the alpha before the public beta you have to stick to the latest alpha we released https://github.com/RevenueCat/purchases-ios/releases/tag/5.3.0-customercenter.alpha.4
The alpha version is also available via Cocoapods. Set your pod to the latest alpha version and enable a Swift flag in your Podfile in order to be able to use it:
pod 'RevenueCat', '5.3.0-customercenter.alpha.4'
pod 'RevenueCatUI', '5.3.0-customercenter.alpha.4'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS='] = '-DCUSTOMER_CENTER_ENABLED'
end
end
end
There are configuration docs available in our docs site
We are hoping to make the beta public on Monday if everything works as expected, and that means you would be able to use the latest purchases-ios for it.
Sorry about that.
@vegaro thanks, we opted to modify the code because using cocoapods to test, it wasn't an option. Would be nice if you could create an option for remove the close button on the trailing side of the view, and the navigationCompatibilityView.
Something like this:
applyIf(closeButtonIsNeeded) { view in
view.toolbar {
ToolbarItem(placement: .compatibleTopBarTrailing) {
DismissCircleButton()
}
}
}
@ViewBuilder
func destinationView(configuration: CustomerCenterConfigData, needsPushNavigation: Bool) -> some View {
let accentColor = Color.from(colorInformation: self.appearance.accentColor, for: self.colorScheme)
Group {
if needsPushNavigation {
destinationContent(configuration: configuration)
} else {
CompatibilityNavigationStack {
destinationContent(configuration: configuration)
}
}
}
.applyIf(accentColor != nil, apply: { $0.tint(accentColor) })
}
and
if #available(iOS 16.0, *), newNavigationIsUsed {
content
.navigationDestination(isPresented: .isNotNil(self.$viewModel.feedbackSurveyData)) {
if let feedbackSurveyData = self.viewModel.feedbackSurveyData {
FeedbackSurveyView(feedbackSurveyData: feedbackSurveyData,
customerCenterActionHandler: self.customerCenterActionHandler)
}
}
} else {
content
.background(NavigationLink(
destination: self.viewModel.feedbackSurveyData.map { data in
FeedbackSurveyView(feedbackSurveyData: data,
customerCenterActionHandler: self.customerCenterActionHandler)
},
isActive: .isNotNil(self.$viewModel.feedbackSurveyData)
) {
EmptyView()
})
}
By adding three parameters — newNavigationIsUsed, needsPushNavigation, and closeButtonIsNeeded — to CustomerCenterView, we enable flexibility in the navigation behavior. This approach ensures:
- Consistency with push navigation: The app will use push-based navigation within navigation stacks instead of presenting new modal views.
- Avoiding modals over modals: By checking closeButtonIsNeeded, we prevent a new modal presentation when it’s unnecessary, avoiding bad UX from stacking multiple modal views.
- Fallback for older navigation styles: We handle both old and new navigation APIs, ensuring that the app works consistently across different iOS versions (e.g., iOS 16+ with NavigationStack vs. older versions with NavigationView), because not all people create both ways even NavigationView is deprecated for iOS 16+.
newNavigationIsUsed: Determines if the app should use the iOS 16+ NavigationStack system with .navigationDestination. When false, it falls back to using NavigationLink. needsPushNavigation: Indicates whether the current view is inside a NavigationView or NavigationStack. When true, the destination content is pushed onto the existing navigation stack, preserving navigation consistency. If false, the content is wrapped in its own navigation stack. closeButtonIsNeeded: Controls whether a close button (e.g., DismissCircleButton) is added to the toolbar. This prevents the scenario of staying on a stacked view in a push navigation and have the chevron to go back and the close button at the same time.
Take the snippets as example, for sure you can create viewModifiers, models, and reduce code.
Thanks
Thank you so much for the detailed feedback. We'll take a look.
Also, we have just released 5.5.0 and enabled the Customer Center for everyone as a public beta
@jesus-mg-iOS thanks again for the detailed explanation. We've released 5.15.0 that introduces NavigationOptions.
Please let us know if there're any other issues 💪