Open
Description
I know that you have plan to include automatic adjust for prayer times, and right now I am working on update for Ela-Salaty and I will use adhan-swift for that...
I already have database with all countries I converted it to json and added adhan-swift paramters...
Please check the json here...
https://www.dropbox.com/s/52kcom2vg1cagq4/Countries.json?dl=1
I use this func to get prayer settings for a country iso
struct Countries: Decodable {
let ISO: String
let Madhab: Int
let Method: String
let HighLatitudeRule: String
}
static func getPrayerSettingsForCountry(iso: String) -> Countries {
let decoder = JSONDecoder()
guard
let url = Bundle.main.url(forResource: "Countries", withExtension: "json"),
let data = try? Data(contentsOf: url),
let countries: [Countries] = try? decoder.decode([Countries].self, from: data),
let index = countries.firstIndex(where: { $0.ISO == iso })
else {
return (Countries(ISO: iso, Madhab: 1, Method: "muslimWorldLeague", HighLatitudeRule: "middleOfTheNight"))
}
return countries[index]
}
I don't know if this good enough for you, or you have a better solution, but I thought I should share this anyway it could be seed to smothing bigger.
Metadata
Metadata
Assignees
Labels
No labels