Color.swift 677 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // Color.swift
  3. // LoopKitUI
  4. //
  5. // Created by Pete Schwamb on 1/3/21.
  6. // Copyright © 2021 LoopKit Authors. All rights reserved.
  7. //
  8. import SwiftUI
  9. private class LocalBundle {
  10. /// Returns the resource bundle associated with the current Swift module.
  11. static var main: Bundle = {
  12. if let mainResourceURL = Bundle.main.resourceURL,
  13. let bundle = Bundle(url: mainResourceURL.appendingPathComponent("LoopKitUI_LoopKitUI.bundle"))
  14. {
  15. return bundle
  16. }
  17. return Bundle(for: LocalBundle.self)
  18. }()
  19. }
  20. extension Color {
  21. init?(frameworkColor name: String) {
  22. self.init(name, bundle: LocalBundle.main)
  23. }
  24. }