-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
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 onboardedAtThis 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
RawRepresentabletypes
But is missing Date?, which is a common type for tracking timestamps in UserDefaults.
Location
File: Sources/RadiantKit/PropertyWrappers/AppStorage/AppStorage+ExpressibleByNilLiteral.swift
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels