Skip to content

Commit 23e0a44

Browse files
committed
Add support for serializing NSFontDescriptor and UIFontDescriptor
1 parent ce45591 commit 23e0a44

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Sources/Defaults/Defaults+Extensions.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ extension NSColor: Defaults.Serializable {}
168168
extension UIColor: Defaults.Serializable {}
169169
#endif
170170

171+
#if os(macOS)
172+
extension NSFontDescriptor: Defaults.Serializable {}
173+
#else
174+
extension UIFontDescriptor: Defaults.Serializable {}
175+
#endif
176+
171177
extension NSUbiquitousKeyValueStore: DefaultsKeyValueStore {}
172178
extension UserDefaults: DefaultsKeyValueStore {}
173179

readme.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ Add `https://github.com/sindresorhus/Defaults` in the [“Swift Package Manager
5454
- `Data`
5555
- `URL`
5656
- `UUID`
57-
- `NSColor` (macOS)
58-
- `UIColor` (iOS)
59-
- `Color` [^1] (SwiftUI)
60-
- `Color.Resolved` [^1] (SwiftUI)
57+
- `Range`
58+
- `ClosedRange`
6159
- `Codable`
6260
- `NSSecureCoding`
63-
- `Range`, `ClosedRange`
61+
- `Color` [^1] (SwiftUI)
62+
- `Color.Resolved` [^1] (SwiftUI)
63+
- `NSColor`
64+
- `UIColor`
65+
- `NSFontDescriptor`
66+
- `UIFontDescriptor`
6467

6568
Defaults also support the above types wrapped in `Array`, `Set`, `Dictionary`, `Range`, `ClosedRange`, and even wrapped in nested types. For example, `[[String: Set<[String: Int]>]]`.
6669

0 commit comments

Comments
 (0)