Skip to content

Commit

Permalink
Update initializer of Defaults to use @autoclosure
Browse files Browse the repository at this point in the history
  • Loading branch information
ktiays authored and unixzii committed Apr 6, 2024
1 parent cb7f80b commit 4a93312
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/CyanUtils/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ public struct Defaults<T> where T: ConstructibleFromDefaults {
}
private let `default`: () -> T

@available(*, deprecated, renamed: "init(key:defaultValue:)", message: "Use init(key:defaultValue:) instead")
public init(key: String, default: @escaping () -> T) {
self.key = key
self.default = `default`
}

public init(key: String, defaultValue: T) {
self.init(key: key) { defaultValue }
public init(key: String, defaultValue: @autoclosure @escaping () -> T) {
self.key = key
self.default = defaultValue
}

public var wrappedValue: T {
Expand Down

0 comments on commit 4a93312

Please sign in to comment.