Sunlight

1.0.0

Calculate dawn, dusk, golden and blue hour times by using various algorithms.
BinaryBirds/Sunlight

What's New

Sunlight (☀️) - v1.0.0

2019-02-11T21:56:08Z
  • first release

Sunlight (☀️)

Calculate dawn, dusk, golden and blue hour times by using various algorithms.

Twilight Types

  • Civil Twilight
  • Nautical Twilight
  • Astronomical Twilight
  • Dawn (official)
  • Dusk (official)
  • The Golden Hour
  • The Blue Hour

Usage

Some examples:

import Sunlight

let sunlight = SunlightCalculator(latitude: 47.49801, longitude: 19.03991)
        
let officialDawn = sunlight.calculate(.dawn, twilight: .official)
let officialDusk = sunlight.calculate(.dusk, twilight: .official)

let civilDawn = sunlight.calculate(.dawn, twilight: .civil)
let civilDusk = sunlight.calculate(.dusk, twilight: .civil)

let astronomicalDawn = sunlight.calculate(.dawn, twilight: .astronomical)
let astronomicalDusk = sunlight.calculate(.dusk, twilight: .astronomical)

let nauticalDawn = sunlight.calculate(.dawn, twilight: .nautical)
let nauticalDusk = sunlight.calculate(.dusk, twilight: .nautical)

let blueHourStart = sunlight.calculate(.dawn, twilight: .custom(-8))
let blueHourEndGoldenHourStart = sunlight.calculate(.dusk, twilight: .custom(-4))
let goldenHourEnd = sunlight.calculate(.dusk, twilight: .custom(6))

Install

Just use the Swift Package Manager as usual:

.package(url: "https://github.com/binarybirds/sunlight", from: "1.0.0"),

⚠️ Don't forget to add "Sunlight" to your target as a dependency!

License

WTFPL - Do what the fuck you want to.

Other sources

Description

  • Swift Tools 4.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 01:19:46 GMT-0900 (Hawaii-Aleutian Daylight Time)