Skip to content

Commit 630838c

Browse files
committed
Foundation: repair Darwin compatibility test suite
Explicitly convert the field to `Bool` from `DarwinBoolean` for encoding to ensure serialisability.
1 parent 653c070 commit 630838c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Foundation/DateIntervalFormatter.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,15 @@ open class DateIntervalFormatter: Formatter {
158158

159159
let dateTemplateFromStylesNS = dateTemplateFromStyles?.takeRetainedValue()._nsObject
160160
aCoder.encode(dateTemplateFromStylesNS, forKey: "NS.dateTemplateFromStyles")
161-
161+
162+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
163+
aCoder.encode(modified.boolValue, forKey: "NS.modified");
164+
aCoder.encode(useTemplate.boolValue, forKey: "NS.useTemplate")
165+
#else
162166
aCoder.encode(modified, forKey: "NS.modified");
163167
aCoder.encode(useTemplate, forKey: "NS.useTemplate")
164-
168+
#endif
169+
165170
let localeNS = locale?.takeRetainedValue()._nsObject
166171
aCoder.encode(localeNS, forKey: "NS.locale")
167172

0 commit comments

Comments
 (0)