Pluggable.swift 776 B

1234567891011121314151617181920212223
  1. //
  2. // Pluggable.swift
  3. // LoopKit
  4. //
  5. // Created by Nathaniel Hamming on 2023-09-08.
  6. // Copyright © 2023 LoopKit Authors. All rights reserved.
  7. //
  8. public protocol Pluggable: AnyObject {
  9. /// The unique identifier for this plugin.
  10. static var pluginIdentifier: String { get }
  11. /// A plugin may need a reference to another plugin. This callback allows for such a reference.
  12. /// It is called once during app initialization after plugins are initialized and again as new plugins are added and initialized.
  13. func initializationComplete(for pluggables: [Pluggable])
  14. }
  15. public extension Pluggable {
  16. var pluginIdentifier: String { return type(of: self).pluginIdentifier }
  17. func initializationComplete(for pluggables: [Pluggable]) { } // optional
  18. }