This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
14 lines
579 B
Swift
14 lines
579 B
Swift
import Foundation
|
|
|
|
extension Date {
|
|
|
|
/// Return a randomized `Date` in the next midnight hour. Will return nil if a `Date` can't be constructed given the calendar
|
|
/// and component constraints, though in practice will likely always return some value.
|
|
func randomDateShortlyAfterMidnight(calendar: Calendar = .current) -> Date? {
|
|
let components = DateComponents(day: 1, minute: .random(in: 0..<30), second: .random(in: 0..<60))
|
|
let startOfDay = calendar.startOfDay(for: self)
|
|
return calendar.date(byAdding: components, to: startOfDay)
|
|
}
|
|
|
|
}
|