Skip to content

NSDateInterval use internal setter #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions Foundation/NSDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,16 @@ extension CFDateRef : _NSBridgable {
/// - Experiment: This is a draft API currently under consideration for official import into Foundation as a suitable alternative to the AutoreleasingUnsafeMutablePointer usage case of returning a NSDate + NSTimeInterval or using a pair of dates representing a range
/// - Note: Since this API is under consideration it may be either removed or revised in the near future
public class NSDateInterval : NSObject {
internal var _start: NSDate
public var start: NSDate {
return _start
}

internal var _end: NSDate
public var end: NSDate {
return _end
}
public internal(set) var start: NSDate
public internal(set) var end: NSDate

public var interval: NSTimeInterval {
return end.timeIntervalSinceReferenceDate - start.timeIntervalSinceReferenceDate
}

public required init(start: NSDate, end: NSDate) {
_start = start
_end = end
self.start = start
self.end = end
}

public convenience init(start: NSDate, interval: NSTimeInterval) {
Expand Down