Extensions

The following extensions are available globally.

Array Casting Operator

  • This allows us to declare an array of weak references to be an array of their contents.

    Note

    Only currently allocated references will be included, and this establishes a strong reference.

    See more

    Declaration

    Swift

    public extension Array where Element: AnyObject

Bundle Extension

  • This extension adds a few simple accessors for some of the more common bundle items.

    See more

    Declaration

    Swift

    public extension Bundle

CGFloat Extension

  • This makes it easier to convert between Degrees and Radians.

    See more

    Declaration

    Swift

    public extension CGFloat

CGSize Extension

  • Adds calculations to the CGSize struct.

    See more

    Declaration

    Swift

    public extension CGSize

CGPoint Extension

Date Extension, To Compare With a 24-Hour “Granularity.”

StringProtocol Extension (Foundation-Required Computed Properties)

ContiguousBytes Extension (Foundation-Required Functions)

  • This was inspired by this SO answer

    These casts are relatively safe, as the returned Arrays will not include any of the remainder memory, in unaligned streams.

    This means that the last memory may not be included in casts.

    See more

    Declaration

    Swift

    public extension ContiguousBytes

FixedWidthInteger Extension

  • These can be applied to any fixed-width integer (signed or unsigned).

    See more

    Declaration

    Swift

    public extension FixedWidthInteger

Double Extension

  • This makes it easier to convert between Degrees and Radians.

    See more

    Declaration

    Swift

    public extension Double

Float Extension

  • This makes it easier to convert between Degrees and Radians.

    See more

    Declaration

    Swift

    public extension Float