You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conform UserDefaults (and UserDefaultsClient) to UserDefaultsProtocol.
The solution enables custom UserDefaults implementations, such as UserDefaultsClient, to integrate seamlessly with the SDK, enhancing flexibility without introducing breaking changes to the public API.
The text was updated successfully, but these errors were encountered:
Our app uses a custom
UserDefaultsClient
interface to manageUserDefaults
, defined as follows:The SDK currently lacks support for abstractions like these, causing a compile error when trying to use
UserDefaultsClient
instead ofUserDefaults
:To work around this limitation, I am forced to add a new dependency endpoint that provides direct access to the wrapped
UserDefaults
instance.However, this workaround defeats the purpose of the abstraction, as it forces us back to using a concrete
UserDefaults
instance.Solution
UserDefaultsProtocol
:Add a protocol to the SDK that mirrors the
UserDefaults
methods used within the SDK:Configuration.Builder
:Add support for
UserDefaultsProtocol
in theConfiguration.Builder
:UserDefaults
(andUserDefaultsClient
) toUserDefaultsProtocol
.The solution enables custom
UserDefaults
implementations, such asUserDefaultsClient
, to integrate seamlessly with the SDK, enhancing flexibility without introducing breaking changes to the public API.The text was updated successfully, but these errors were encountered: