Wrapping Protocols

  • Undocumented

    See more

    Declaration

    Swift

    public protocol NewType
  • Undocumented

    See more

    Declaration

    Swift

    public protocol IntegerWrapping : Comparable, ExpressibleByIntegerLiteral, Hashable
  • Undocumented

    See more

    Declaration

    Swift

    public protocol FloatWrapping:
        ExpressibleByFloatLiteral,
        ExpressibleByIntegerLiteral,
        Hashable,
        Comparable
  • Undocumented

    See more

    Declaration

    Swift

    public protocol DoubleWrapping:
        ExpressibleByFloatLiteral,
        ExpressibleByIntegerLiteral,
        Hashable,
        Comparable
  • SequenceWrapping is a type-erasing protocol that allows a Sequence-conforming structure to wrap any underlying Sequence implementation.

    For example, PitchSet and PitchCollection are both containers for Pitch values, and should both be able to be used as Sequence conforming structures.

    By conforming to this protocol, the PitchSet can use a Set<Pitch> as its underlying model, while PitchSequence can use an Array<Pitch> as its underlying model.

    In the conforming struct, it is necessary to add a private var which is an implementation of a Sequence-conforming struct, which is then given by the sequence getter.

    In the init method of the conforming struct, set the value of this private var with the given sequence.

    See more

    Declaration

    Swift

    public protocol SequenceWrapping : Sequence
  • CollectionWrapping is a type-erasing protocol that allows a Collection-conforming structure to wrap any underlying Collection implementation.

    As a result, all of the Collection boilerplate is done for free.

    See more

    Declaration

    Swift

    public protocol CollectionWrapping : Collection
  • Undocumented

    See more

    Declaration

    Swift

    public protocol SortedCollectionWrapping : Collection
  • Interface for wrapping any RandomAccessCollection type. The RandomAccessCollection interface is exposed, regardless of the concrete implementation of the wrapped type.

    The performance guarantees made by the RandomAccessCollection are sustained.

    See more

    Declaration

    Swift

    public protocol RandomAccessCollectionWrapping : RandomAccessCollection