From 54951e6400c7b2d91d608bf54ceee35d862df134 Mon Sep 17 00:00:00 2001 From: Andy Boedo Date: Thu, 15 Aug 2024 13:19:38 -0300 Subject: [PATCH] fixed issue where the plus sign icon wouldn't work correctly after the name change --- RevenueCatUI/Views/IconView.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/RevenueCatUI/Views/IconView.swift b/RevenueCatUI/Views/IconView.swift index 4138cdb16f..e7535043b3 100644 --- a/RevenueCatUI/Views/IconView.swift +++ b/RevenueCatUI/Views/IconView.swift @@ -22,7 +22,7 @@ struct IconView: View { let tint: S var body: some View { - Image(self.icon.rawValue, bundle: .module) + Image(self.icon.localAssetName, bundle: .module) .renderingMode(.template) .resizable() .scaledToFit() @@ -35,7 +35,7 @@ struct IconView: View { /// An icon to be displayed by `IconView`. enum PaywallIcon: String, CaseIterable { - case plus + case plus = "add" case android case apple case attachMoney = "attach_money" @@ -82,6 +82,17 @@ enum PaywallIcon: String, CaseIterable { case key case warning + // in some cases, the local asset name can't match the backend's names + // because it causes issues with UIKit's names when generating intermediate files. + // this allows us to decouple the local asset name from the backend's name for the icon. + var localAssetName: String { + switch self { + case .plus: + return "plus" + default: + return self.rawValue + } + } } extension PaywallData.LocalizedConfiguration.Feature {