Delegates

public class Delegates<T>

A generic class for managing collections of delegates properly with weak references

  • Add a new delegate

    Declaration

    Swift

    public func add(_ delegate: T)
  • Remove a specific delegate

    Declaration

    Swift

    public func remove(_ delegate: T)
  • Remove all delegates

    Declaration

    Swift

    public func removeAll()
  • Iterate over the delegates with a closure to make calls, send messages, do work

    i.e., you can do .notify({ $0.someDelegateCall(...) })

    Declaration

    Swift

    public func notify(_ todo: (_ theDelegate: T) -> Void)