{"id":1064,"url":"https://github.com/ceeK/Solar","last_synced_at":"2025-08-06T16:32:11.763Z","repository":{"id":48635492,"uuid":"49777331","full_name":"ceeK/Solar","owner":"ceeK","description":"A Swift micro library for generating Sunrise and Sunset times.","archived":false,"fork":false,"pushed_at":"2021-07-16T16:10:19.000Z","size":168,"stargazers_count":568,"open_issues_count":10,"forks_count":82,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-12-03T17:57:34.831Z","etag":null,"topics":["ios","macos","osx","sunrise","sunset","swift","swift-4"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ceeK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-16T14:47:53.000Z","updated_at":"2024-11-15T21:03:30.000Z","dependencies_parsed_at":"2022-08-16T05:30:42.269Z","dependency_job_id":null,"html_url":"https://github.com/ceeK/Solar","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceeK%2FSolar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceeK%2FSolar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceeK%2FSolar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ceeK%2FSolar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ceeK","download_url":"https://codeload.github.com/ceeK/Solar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228923758,"owners_count":17992574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","macos","osx","sunrise","sunset","swift","swift-4"],"created_at":"2024-01-05T20:15:38.141Z","updated_at":"2024-12-09T16:31:19.577Z","avatar_url":"https://github.com/ceeK.png","language":"Swift","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./solar-logo.png\" /\u003e\n\u003c/div\u003e\n\n# Solar\n\n[![Version](https://img.shields.io/cocoapods/v/Solar.svg?style=flat)](http://cocoapods.org/pods/Solar) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![POD compatible](https://img.shields.io/badge/Cocoapods-compatible-4BC51D.svg?style=flat)](https://cocoapods.org) [![SPM compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager/) [![Build Status](https://travis-ci.org/ceeK/Solar.svg?branch=master)](https://travis-ci.org/ceeK/Solar)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/hyperium/hyper/master/LICENSE)\n\nA Swift helper for generating Sunrise and Sunset times. \n\nSolar performs its calculations locally using an algorithm from the [United States Naval Observatory](http://edwilliams.org/sunrise_sunset_algorithm.htm), and thus does not require the use of a network.\n\n## Usage\n\nSolar simply needs a date and a location specified as a latitude and longitude:\n\n```swift\nlet solar = Solar(for: someDate, coordinate: CLLocationCoordinate2D(latitude: 51.528308, longitude: -0.1340267))\nlet sunrise = solar?.sunrise\nlet sunset = solar?.sunset\n```\n\nWe can also omit providing a date if we just need the sunrise and sunset for the current date and time:\n\n```swift\nlet solar = Solar(coordinate: CLLocationCoordinate2D(latitude: 51.528308, longitude: -0.1340267))\nlet sunrise = solar?.sunrise\nlet sunset = solar?.sunset\n```\n\nNote that all dates are UTC. Don't forget to format your date into the appropriate timezone if required.\n\n### Types of sunrise and sunset\n\nThere are several types of sunrise and sunset that Solar generates. They differ by how many degrees the sun lies below the horizon:\n\n- **Official** (~0°)\n\n- **Civil** (6° below horizon)\n\n- **Nautical** (12° below horizon)\n\n- **Astronomical** (18° below horizon)\n\nFor more information, see https://www.timeanddate.com/astronomy/different-types-twilight.html\n\n## Convenience methods\n\nSolar also comes packaged with some convenience methods:\n\n```swift\n// Whether the location specified by the `latitude` and `longitude` is in daytime on `date`\nlet isDaytime = solar.isDaytime\n\n// Whether the location specified by the `latitude` and `longitude` is in nighttime on `date`\nlet isNighttime = solar.isNighttime\n```\n\n## Installation\n\nSolar is available through CocoaPods, Carthage, and Swift Package Manager. \n\n### CocoaPods\n\nTo include Solar in an application, add the following [pod](https://guides.cocoapods.org/syntax/podfile.html#pod) to your Podfile, then run `pod install`:\n\n```ruby\npod \"Solar-dev\", \"~\u003e 3.0\"\n```\n\nTo include Solar in another pod, add the following [dependency](https://guides.cocoapods.org/syntax/podspec.html#dependency) to your podspec:\n\n```ruby\ns.dependency \"Solar\", \"~\u003e 3.0\"\n```\n\n### Carthage\n\nAdd the `ceek/Solar` project to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile), then follow the rest of [Carthage’s XCFramework installation instructions](https://github.com/Carthage/Carthage#building-platform-independent-xcframeworks-xcode-12-and-above):\n\n```ruby\ngithub \"ceeK/Solar\" ~\u003e 3.0\n```\n\n### Swift Package Manager\n\nTo include Solar in an application in Xcode:\n\n1. Go to File ‣ Swift Packages ‣ Add Package Dependency.\n1. Enter `https://github.com/ceeK/Solar.git` as the package repository and click Next.\n1. Set Rules to Version, Up to Next Major, and enter `3.0.0` as the minimum version requirement. Click Next.\n\nTo include Solar in another Swift package, add the following [dependency](https://developer.apple.com/documentation/swift_packages/package/dependency) to your Package.swift:\n\n```swift\n.package(name: \"Solar\", url: \"https://github.com/ceeK/Solar.git\", from: \"3.0.0\")\n```\n\n# License \n\nThe MIT License (MIT)\n\nCopyright (c) 2016-2021 Chris Howell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":["Date \u0026 Time","Libs","Swift","Utility [🔝](#readme)"],"sub_categories":["Getting Started","Utility","Other free courses","Linter"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FceeK%2FSolar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FceeK%2FSolar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FceeK%2FSolar/lists"}