3 ms·
There's a fun thing like this in Swift too! `Void` is an empty tuple, and has all of the related constraints (can't conform to protocols, being the most salient
by JackYoustra 2y ago
There's a fun thing like this in Swift too! `Void` is an empty tuple, and has all of the related constraints (can't conform to protocols, being the most salient one). If you have a type that has to conform to, say, `Equatable` or `Codable` you should instead use `Never?` which you can conform to most protocols via throwing `fatalError` on an extension of `Never` to the protocol.
Anyway, I write basically this on my blog for a more thorough explanation: https://www.jackyoustra.com/blog/non-equatable-void https://www.jackyoustra.com/blog/non-equatable-void
- tymscar 2y agoLovely blog! If you would accept one suggestion, it would be to make it mobile friendly!
- JackYoustra 2y agoI'm glad to have a mobile reader :) I'll work on making it mobile friendly soon
- JackYoustra 2y agoShould be better now! Let me know if you have further concerns :)