batoulapps / adhan-swift

High precision Islamic prayer time library for Swift
MIT License
185 stars 46 forks source link

Prayer Times: Add convenience intializer #80

Closed imthath-m closed 1 year ago

imthath-m commented 1 year ago

Add convenience intializer using Date and CalculationMethod types with default values

z3bi commented 1 year ago

I think this convenience initializer could hide necessary information that could lead to a developer introducing undesired behavior into their app. I don't think a default calculation method makes sense, each calculation method is valid for a specific area and by setting a default it might make a developer assume its validity in situations where it shouldn't be used.

I also think it's helpful that our initializer requires DateComponents. This signals to the developer that they are responsible for choosing a calendar with the correct timezone set that will give the expected DateComponents. By using the currentCalendar you are assuming the target's timezone is the same as the system, which may not be correct.