Skip to content

Commit 54e15e4

Browse files
committed
Fixed case where Locale would be unintialized
1 parent 598bb50 commit 54e15e4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Foundation/NSDateFormatter.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,16 @@ public class NSDateFormatter : NSFormatter {
100100

101101
public var timeStyle: NSDateFormatterStyle = .NoStyle { willSet { _reset() } }
102102

103-
/*@NSCopying*/ public var locale: NSLocale! { willSet { _reset() } }
103+
internal var _locale: NSLocale = NSLocale.currentLocale()
104+
/*@NSCopying*/ public var locale: NSLocale! {
105+
get {
106+
return _locale
107+
}
108+
set {
109+
_reset()
110+
_locale = newValue
111+
}
112+
}
104113

105114
public var generatesCalendarDates = false { willSet { _reset() } }
106115

0 commit comments

Comments
 (0)