Tuesday, March 13, 2018

Swift 4.1 Conditional Conformance Is Amazing

Stephen Celis:

Here’s a non-empty collection type that works with any collection.

Wrapping a MutableCollection type gives the non-empty type all those methods for free!

Previously: Conditional Conformance in the Standard Library.

Update (2018-03-23): See also: Swift Unwrapped.

Update (2018-03-27): See also: Swift Unwrapped.

Update (2018-05-01): See also: Ole Begemann.

1 Comment RSS · Twitter

[…] Swift 4: Synthesizing Equatable and Hashable Conformance, Swift 4.1 Conditional Conformance Is Amazing, Code Size Optimization Mode in Swift […]

Leave a Comment