Open d4rkd3v1l opened 4 years ago
Hey @d4rkd3v1l - thank you for the issue, this is a very good suggestion. We should remove it if possible (not sure why is OptionalType
a public protocol, but this is why we expose these properties).
Hello @d4rkd3v1l
OptionalType
is using in the public
extensions in DefaultsKey.swift and Defaults+Subscripts.swift. As for me, you should refactor you code with myOptionalString == String.empty
or any other solution.
I'm a bit concerned about defining such a general/global extension public in a pod:
We have an extension on String:
Now when comparing an optional String to
.empty
, this will use your extension instead of our own extension on String. That really was no fun debugging -.-Anyway, we can (and maybe even should) fix this on our side by writing our own extension specifically for optional Strings, or use
String.empty
explicitly, and so on. But in my opinion this is really error prone in such circumstances and can lead to quite unexpected behaviour.