Description
RadiantKit's AppStorage extensions are missing an initializer for optional Date (Date?) types. This prevents using @AppStorage(for:) with AppStored types that have Value = Date?.
Current Behavior
When attempting to use:
public enum Onboarding {
public enum Glass: RadiantKit.AppStored {
public static let keyType: RadiantKit.KeyType = .reflecting
public typealias Value = Date?
}
}
// Usage:
@AppStorage(for: Onboarding.Glass.self) private var onboardedAt
This results in a compilation error:
error: no exact matches in call to initializer
Expected Behavior
An initializer should exist in AppStorage+ExpressibleByNilLiteral.swift to support Date?:
extension AppStorage where Value: ExpressibleByNilLiteral {
public init<AppStoredType: AppStored>(
for type: AppStoredType.Type,
store: UserDefaults? = nil
)
where
AppStoredType.Value == Value,
Value == Date? {
self.init(type.key, store: store)
}
}
Additional Context
The extension file already includes initializers for:
Bool?
Int?
Double?
String?
URL?
Data?
- Optional
RawRepresentable types
But is missing Date?, which is a common type for tracking timestamps in UserDefaults.
Location
File: Sources/RadiantKit/PropertyWrappers/AppStorage/AppStorage+ExpressibleByNilLiteral.swift
Description
RadiantKit's
AppStorageextensions are missing an initializer for optionalDate(Date?) types. This prevents using@AppStorage(for:)withAppStoredtypes that haveValue = Date?.Current Behavior
When attempting to use:
This results in a compilation error:
Expected Behavior
An initializer should exist in
AppStorage+ExpressibleByNilLiteral.swiftto supportDate?:Additional Context
The extension file already includes initializers for:
Bool?Int?Double?String?URL?Data?RawRepresentabletypesBut is missing
Date?, which is a common type for tracking timestamps in UserDefaults.Location
File:
Sources/RadiantKit/PropertyWrappers/AppStorage/AppStorage+ExpressibleByNilLiteral.swift