Skip to content

Enhancement - Location is in Daylight #3

Description

@Danny-SS

I stumbled across this looking for a map overlay for MapKit to show daylight/night over map of the world. I am glad to see a solid foundation in this project.

Here's an enhancement I'd like to see:

Given a longitude and latitude, at the current time, is that location in daylight or darkness.

[User could choose what they consider daylight from the SolarEvent enum. It would be great if we did not have to worry about time zone and just a location on earth at the current time.]

So maybe something like:

let currentLocation = CLLocationCoordinate2D(latitude: 40.642, longitude: -74.017)
let inDaylight: Bool = currentLocation.inDaylight(usingDawn: .civilDawn, andDusk: .civilDusk)

I'll be playing around with what you have. Beats starting from NASA's codeI've seen since this is already migrated to Swift.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions