You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -134,7 +134,7 @@ Another example is using the generic `prefix` function. Here, it is combined wit
134
134
var matchingComps =DateComponents()
135
135
matchingComps.dayOfYear=234
136
136
// Including a leap year, find the next 5 "day 234"s
137
-
let result = cal.dates(startingAt: date, matching: matchingComps).prefix(5)
137
+
let result = cal.dates(byMatching: matchingComps, startingAt: date).prefix(5)
138
138
/*
139
139
Result:
140
140
2022-08-22 00:00:00 +0000
@@ -159,7 +159,7 @@ cal.timeZone = TimeZone.gmt
159
159
var dc =DateComponents()
160
160
dc.hour=22
161
161
162
-
let result = cal.dates(startingAt: startDate, in: startDate..<endDate, matching: dc)
162
+
let result = cal.dates(byMatching: dc, startingAt: startDate, in: startDate..<endDate)
163
163
/*
164
164
Result:
165
165
2022-08-23 22:00:00 +0000
@@ -171,7 +171,7 @@ let result = cal.dates(startingAt: startDate, in: startDate..<endDate, matching:
171
171
The API also allows for backwards searches. Note that the `Range` remains ordered forward in time as Swift does not allow for reverse ranges. The separation of the starting point from the range allows for the caller to control where they want the search to start in the range (start or end, for example). The search can also start outside of the range, and will return results as long as the first result is inside of the range. The sequence terminates as soon as a result is not contained in the range.
172
172
173
173
```swift
174
-
let result = cal.dates(startingAt: endDate, in: startDate..<endDate, matching: dc, direction: .backward)
174
+
let result = cal.dates(byMatching: dc, startingAt: endDate, in: startDate..<endDate, direction: .backward)
175
175
/*
176
176
Result:
177
177
2022-08-25 22:00:00 +0000
@@ -202,7 +202,7 @@ let endDate = startDate + (86400 * 3) + (3600 * 2) // 3 days + 2 hours later - c
0 commit comments