About this project

AstronomyKit is a Swift library for calculating positions of the Sun, Moon, planets, and fixed stars. It predicts moon phases, eclipses, transits, and rise/set times, and is accurate to ±1 arcminute based on VSOP87 and NOVAS C 3.1 models validated against JPL Horizons. It runs entirely on-device and is built on Don Cross' Astronomy Engine C library. Key features include: - Positions for the Sun, Moon, planets, and Jupiter's Galilean moons - Ecliptic position and velocity in one call (longitude, latitude, distance, and rates) - Moon phase angles, quarters, illumination, and libration - User-defined fixed stars from J2000 catalog coordinates - Gravity-simulated positions for 2060 Chiron (using pre-computed JPL Horizons state vectors) - Rise, set, and culmination times - Lunar and solar eclipse predictions - Equinoxes and solstices - Coordinate transforms across equatorial, ecliptic, horizon, and galactic systems - Planetary conjunctions, oppositions, and relative longitude search - Apsides, elongation, and transits (Mercury/Venus solar transits) - Generic root-finding search for custom astronomical events - Full Sendable conformance for Swift 6 concurrency Supported dates span roughly −2000 to +6000 (about 4,000 Julian years from J2000), with Pluto's range narrower (about −100 to +4100). For 1900–2100, the library evaluates polynomial approximations of the complete VSOP87B model; segments failing regression checks or dates outside coverage fall back to the original series. The polynomial tables add about 11.5 MB before packaging, with no runtime downloads. The library supports macOS 15+, iOS 18+, tvOS 18+, watchOS 11+, and Linux, requiring Swift 6.0+. It is available via Swift Package Manager. DocC documentation is hosted online. Two apps are built with it: Fallow (a lunar fasting companion) and Edict (an electional astrology planner). Licensed under MIT.