by mapmap · 8y ago · 0 comments
Required 1. Download finishes 2. Download fails
Optional 3. Download progress (for updating a progress bar)
This seems legit to me. Would one really want the added overhead of having to implement 3 as a separate protocol?
In your first comment you seem to value the ability to "quickly digest key object interfaces and concepts" but you balk at the added clarity afforded by separating different behaviors into distinct protocols?
If by "overhead" you mean a cost to performance, worrying about it at that level falls under premature optimization, until you're certain that the extra protocol noticeably harms performance.
If you really insist on having a single protocol, then make `progress` an optional computed property.
[0] https://developer.apple.com/documentation/foundation/progres...
[1] https://developer.apple.com/documentation/foundation/progres...