@@ -36,6 +36,51 @@ open class DateFormatter : Formatter {
36
36
super. init ( coder: coder)
37
37
}
38
38
39
+ open override func copy( with zone: NSZone ? = nil ) -> Any {
40
+ let copied = DateFormatter ( )
41
+
42
+ func __copy< T> ( _ keyPath: ReferenceWritableKeyPath < DateFormatter , T > ) {
43
+ copied [ keyPath: keyPath] = self [ keyPath: keyPath]
44
+ }
45
+
46
+ __copy ( \. formattingContext)
47
+ __copy ( \. dateStyle)
48
+ __copy ( \. timeStyle)
49
+ __copy ( \. _locale)
50
+ __copy ( \. generatesCalendarDates)
51
+ __copy ( \. _timeZone)
52
+ __copy ( \. _calendar)
53
+ __copy ( \. isLenient)
54
+ __copy ( \. _twoDigitStartDate)
55
+ __copy ( \. _eraSymbols)
56
+ __copy ( \. _monthSymbols)
57
+ __copy ( \. _shortMonthSymbols)
58
+ __copy ( \. _weekdaySymbols)
59
+ __copy ( \. _shortWeekdaySymbols)
60
+ __copy ( \. _amSymbol)
61
+ __copy ( \. _pmSymbol)
62
+ __copy ( \. _longEraSymbols)
63
+ __copy ( \. _veryShortMonthSymbols)
64
+ __copy ( \. _standaloneMonthSymbols)
65
+ __copy ( \. _shortStandaloneMonthSymbols)
66
+ __copy ( \. _veryShortStandaloneMonthSymbols)
67
+ __copy ( \. _veryShortWeekdaySymbols)
68
+ __copy ( \. _standaloneWeekdaySymbols)
69
+ __copy ( \. _shortStandaloneWeekdaySymbols)
70
+ __copy ( \. _veryShortStandaloneWeekdaySymbols)
71
+ __copy ( \. _quarterSymbols)
72
+ __copy ( \. _shortQuarterSymbols)
73
+ __copy ( \. _standaloneQuarterSymbols)
74
+ __copy ( \. _shortStandaloneQuarterSymbols)
75
+ __copy ( \. _gregorianStartDate)
76
+ __copy ( \. doesRelativeDateFormatting)
77
+
78
+ // The last is `_dateFormat` because setting `dateStyle` and `timeStyle` make it `nil`.
79
+ __copy ( \. _dateFormat)
80
+
81
+ return copied
82
+ }
83
+
39
84
open var formattingContext : Context = . unknown // default is NSFormattingContextUnknown
40
85
41
86
@available ( * , unavailable, renamed: " date(from:) " )
0 commit comments