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
extension Date { | |
/// Note: Any duplicate found from 2 components will return nil | |
func combine(_ date1Comp: Set<Calendar.Component>, with date2: Date, components date2Comp: Set<Calendar.Component>) -> Date? { | |
// Check if has duplicates | |
let date1CompDict: [Calendar.Component: Bool] = { | |
var dict: [Calendar.Component: Bool] = [:] | |
date1Comp.forEach{ dict[$0] = true } |