Skip to content

Commit

Permalink
fixed issue that would cause archiving errors when exporting XCFramework
Browse files Browse the repository at this point in the history
  • Loading branch information
aboedo committed Aug 12, 2024
1 parent 8e5c62e commit e811671
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions RevenueCatUI/Modifiers/ViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ extension View {
perform action: @escaping (_ newValue: V) -> Void
) -> some View where V: Equatable {
#if swift(>=5.9)
// wrapping with AnyView to type erase is needed because when archiving an xcframework,
// the compiler gets confused between the types returned
// by the different implementations of self.onChange(of:value).
if #available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *) {
self.onChange(of: value) { _, newValue in action(newValue) }
AnyView(self.onChange(of: value) { _, newValue in action(newValue) })
} else {
self.onChange(of: value) { newValue in action(newValue) }
AnyView(self.onChange(of: value) { newValue in action(newValue) })
}
#else
self.onChange(of: value) { newValue in action(newValue) }
Expand Down

0 comments on commit e811671

Please sign in to comment.