Environment+AppName.swift 590 B

1234567891011121314151617181920212223
  1. //
  2. // Environment+AppName.swift
  3. // LoopUI
  4. //
  5. // Created by Rick Pasetto on 7/1/20.
  6. // Copyright © 2020 LoopKit Authors. All rights reserved.
  7. //
  8. import SwiftUI
  9. private struct AppNameKey: EnvironmentKey {
  10. // Reasonable default value, but the expectation is that this is overridden by the clients of LoopKit, e.g.
  11. // MyView().environment(\.appName, Bundle.main.bundleDisplayName)
  12. static let defaultValue = "Loop"
  13. }
  14. public extension EnvironmentValues {
  15. var appName: String {
  16. get { self[AppNameKey.self] }
  17. set { self[AppNameKey.self] = newValue }
  18. }
  19. }