In the README, there is an example to support existing types with different bridges, you can extend it similarly:
extension Data: DefaultsSerializable {
public static var _defaultsArray: DefaultsArrayBridge<[T]> { DefaultsArrayBridge() }
public static var _defaults: DefaultsDataBridge { DefaultsDataBridge() }
}
However, saying if I'd like to use a different bridge on Data type. For example,
public struct MyDataBridge: DefaultsBridge {
public init() {}
public func save(key: String, value: Data?, userDefaults: UserDefaults) {
// Do nothing
}
public func get(key: String, userDefaults: UserDefaults) -> Data? {
return nil
}
public func deserialize(_ object: Any) -> Data? {
return nil
}
}
extension Data: DefaultsSerializable {
public static var _defaults: MyDataBridge { MyDataBridge() }
}
I will get the compilation warning of Conformance of 'Data' to protocol 'DefaultsSerializable' was already stated in the protocol's module 'SwiftyUserDefaults'. So is it even possible to change the bridge for types that have already been implemented in the module?
In the README, there is an example to support existing types with different bridges, you can extend it similarly:
However, saying if I'd like to use a different bridge on
Data
type. For example,I will get the compilation warning of
Conformance of 'Data' to protocol 'DefaultsSerializable' was already stated in the protocol's module 'SwiftyUserDefaults'
. So is it even possible to change the bridge for types that have already been implemented in the module?Thanks