This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let today = Date() | |
| let nextDate = Calendar.current.date(byAdding: .day, value: 155, to: today) | |
| let result = countDays(6, start: today, end: nextDate) | |
| print(result) | |
| func countDays(_ dayCode: Int, start stDate: Date?, end endDate: Date?) -> Int { | |
| // day code is Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4, Thursday = 5, Friday = 6, Saturday = 7 | |
| var count = 0 | |
| var oneDay = DateComponents() |