Skip to content

Commit 6d932fb

Browse files
committed
TimeZone.init(secondsFromGMT:) made not optional
1 parent c55741b commit 6d932fb

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Foundation/TimeZone.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ public struct TimeZone : Hashable, Equatable, ReferenceConvertible {
7878
/// Time zones created with this never have daylight savings and the offset is constant no matter the date. The identifier and abbreviation do NOT follow the POSIX convention (of minutes-west).
7979
///
8080
/// - parameter seconds: The number of seconds from GMT.
81-
/// - returns: A time zone, or `nil` if a valid time zone could not be created from `seconds`.
82-
public init?(secondsFromGMT seconds: Int) {
83-
if let r = NSTimeZone(forSecondsFromGMT: seconds) as NSTimeZone? {
84-
_wrapped = r
85-
_autoupdating = false
86-
} else {
87-
return nil
88-
}
81+
/// - returns: A time zone.
82+
public init(secondsFromGMT seconds: Int) {
83+
_wrapped = NSTimeZone(forSecondsFromGMT: seconds)
84+
_autoupdating = false
8985
}
9086

9187
/// Returns a time zone identified by a given abbreviation.

0 commit comments

Comments
 (0)