|
|
@@ -11,6 +11,18 @@ internal import Combine
|
|
|
|
|
|
typealias URLHintArray = [URLHint]
|
|
|
|
|
|
+/**
|
|
|
+ * @brief Provides a UserDefaults-compatibiliy layer for Array<URLHint> that
|
|
|
+ * allows seamless reading/writing on program startup and changes.
|
|
|
+ * We bind this type to its JSON-String representation rather than, say, an
|
|
|
+ * Array of dictionaries because @AppStorage only operates on scalar types.
|
|
|
+ *
|
|
|
+ * @author Sam Jaffe
|
|
|
+ * @author KD Knowledge Diet https://paigeshin1991.medium.com/saving-custom-codable-types-in-appstorage-or-scenestorage-in-swiftui-0073032f3f94
|
|
|
+ *
|
|
|
+ * The \@retroactive guards against the Swift developers changing Array<T> to
|
|
|
+ * comply w/ RawRepresentable in the future
|
|
|
+ */
|
|
|
extension URLHintArray : @retroactive RawRepresentable {
|
|
|
public init?(rawValue: String) {
|
|
|
guard let data = rawValue.data(using: .utf8),
|