Skip to content

[NSCalendar] Updated to match Darwin version #439

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
Jul 11, 2016
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Foundation/NSCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public class Calendar: NSObject, NSCopying, NSSecureCoding {
}


public class func currentCalendar() -> Calendar {
public class var current: Calendar {
return CFCalendarCopyCurrent()._nsObject
}

Expand Down
6 changes: 3 additions & 3 deletions TestFoundation/TestNSCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ class TestNSCalendar: XCTestCase {
XCTAssertNil(calendar)
}

func test_currentCalendarRRstability() {
func test_currentRRstability() {
var AMSymbols = [String]()
for _ in 1...10 {
let cal = Calendar.currentCalendar()
let cal = Calendar.current
AMSymbols.append(cal.AMSymbol)
}

XCTAssertEqual(AMSymbols.count, 10, "Accessing current calendar should work over multiple callouts")
}

func test_copy() {
let calendar = Calendar.currentCalendar()
let calendar = Calendar.current

//Mutate below fields and check if change is being reflected in copy.
calendar.firstWeekday = 2
Expand Down