diff --git a/Sources/Plot/API/EnvironmentKey.swift b/Sources/Plot/API/EnvironmentKey.swift index 10fda7b..e5eb081 100644 --- a/Sources/Plot/API/EnvironmentKey.swift +++ b/Sources/Plot/API/EnvironmentKey.swift @@ -39,11 +39,11 @@ public extension EnvironmentKey { } } -public extension EnvironmentKey where Value: ExpressibleByNilLiteral { +public extension EnvironmentKey { /// Initialize a key with an explicit identifier. /// - parameter identifier: The identifier that the key should have. Must /// be a static string that's defined using a compile time literal. - init(identifier: StaticString) { + init(identifier: StaticString) where Value == T? { self.init(identifier: identifier, defaultValue: nil) } @@ -51,7 +51,7 @@ public extension EnvironmentKey where Value: ExpressibleByNilLiteral { /// be computed based on the name of the property or function that created it. /// - parameter autoIdentifier: This parameter will be filled in by the /// compiler based on the name of the call site's enclosing function/property. - init(autoIdentifier: StaticString = #function) { + init(autoIdentifier: StaticString = #function) where Value == T? { self.init(identifier: autoIdentifier, defaultValue: nil) } } diff --git a/Sources/Plot/API/HTMLAnchorTarget.swift b/Sources/Plot/API/HTMLAnchorTarget.swift index 0eff6bd..ba7f890 100644 --- a/Sources/Plot/API/HTMLAnchorTarget.swift +++ b/Sources/Plot/API/HTMLAnchorTarget.swift @@ -10,7 +10,7 @@ import Foundation /// attribute, which specifies how its URL should be opened. public enum HTMLAnchorTarget: String { /// The URL should be opened in the current browser context (default). - case `self` = "self" + case current = "self" /// The URL should be opened in a new, blank tab or window. case blank = "_blank" /// The URL should be opened in any parent frame. @@ -18,3 +18,8 @@ public enum HTMLAnchorTarget: String { /// The URL should be opened in the topmost frame. case top = "_top" } + +extension HTMLAnchorTarget { + @available(*, deprecated, message: "Use .current instead") + static var `self`: Self { current } +}