All Projects → ceeK → Solar

ceeK / Solar

Licence: mit
A Swift micro library for generating Sunrise and Sunset times.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Solar

Autoedit 2
Fast text based video editing, node Electron Os X desktop app, with Backbone front end.
Stars: ✭ 343 (-16.14%)
Mutual labels:  osx
Icons Flat Osx
Free Flat icons For OSX
Stars: ✭ 366 (-10.51%)
Mutual labels:  osx
Macos headers
📚 A consistently maintained dump of most macOS Headers
Stars: ✭ 374 (-8.56%)
Mutual labels:  osx
Marky
A markdown editor built with Electron and React
Stars: ✭ 355 (-13.2%)
Mutual labels:  osx
Folderify
📁 Generate pixel-perfect macOS folder icons in the native style. Ready for macOS 11.0 Big Sur.
Stars: ✭ 359 (-12.22%)
Mutual labels:  osx
Cget
C++ package retrieval
Stars: ✭ 370 (-9.54%)
Mutual labels:  osx
Stprivilegedtask
An NSTask-like wrapper around the macOS Security Framework's AEWP function to run shell commands with root privileges in Objective-C / Cocoa.
Stars: ✭ 335 (-18.09%)
Mutual labels:  osx
Lein template descjop
A Leiningen template(Clojure/ClojureScript Project) for Web based desktop application with Electron (atom-shell).
Stars: ✭ 394 (-3.67%)
Mutual labels:  osx
Unsign
Remove code signatures from OSX Mach-O binaries (note: unsigned binaries cannot currently be re-codesign'ed. Patches welcome!)
Stars: ✭ 362 (-11.49%)
Mutual labels:  osx
Cartool
Mac上解压Assets.car文件的小工具(支持右键解压)
Stars: ✭ 375 (-8.31%)
Mutual labels:  osx
30daymakeos
《30天自制操作系统》源码中文版。自己制作一个操作系统(OSASK)的过程
Stars: ✭ 4,127 (+909.05%)
Mutual labels:  osx
Dlangide
D language IDE based on DlangUI
Stars: ✭ 358 (-12.47%)
Mutual labels:  osx
Water
Simple calculation to render cheap water effects.
Stars: ✭ 372 (-9.05%)
Mutual labels:  osx
Minta
✳️  Electron app for generating regular expressions
Stars: ✭ 353 (-13.69%)
Mutual labels:  osx
Osx Abi Macho File Format Reference
Mirror of OS X ABI Mach-O File Format Reference
Stars: ✭ 379 (-7.33%)
Mutual labels:  osx
Vscodejupyter
Jupyter for Visual Studio Code
Stars: ✭ 337 (-17.6%)
Mutual labels:  osx
Highlight
Rich featured syntax highlighter for Keynote slides.
Stars: ✭ 367 (-10.27%)
Mutual labels:  osx
Daemonize
daemonize is a library for writing system daemons in Python.
Stars: ✭ 396 (-3.18%)
Mutual labels:  osx
Headsetcontrol
Sidetone and Battery status for Logitech G930, G533, G633, G933 SteelSeries Arctis 7/PRO 2019 and Corsair VOID (Pro) in Linux and MacOSX
Stars: ✭ 392 (-4.16%)
Mutual labels:  osx
Infosec reference
An Information Security Reference That Doesn't Suck; https://rmusser.net/git/admin-2/Infosec_Reference for non-MS Git hosted version.
Stars: ✭ 4,162 (+917.6%)
Mutual labels:  osx

Solar

Version Carthage compatible POD compatible SPM compatible Build Status MIT licensed

A Swift helper for generating Sunrise and Sunset times.

Solar performs its calculations locally using an algorithm from the United States Naval Observatory, and thus does not require the use of a network.

Usage

Solar simply needs a date and a location specified as a latitude and longitude:

let solar = Solar(for: someDate, coordinate: CLLocationCoordinate2D(latitude: 51.528308, longitude: -0.1340267))
let sunrise = solar?.sunrise
let sunset = solar?.sunset

We can also omit providing a date if we just need the sunrise and sunset for the current date and time:

let solar = Solar(coordinate: CLLocationCoordinate2D(latitude: 51.528308, longitude: -0.1340267))
let sunrise = solar?.sunrise
let sunset = solar?.sunset

Note that all dates are UTC. Don't forget to format your date into the appropriate timezone if required.

Types of sunrise and sunset

There are several types of sunrise and sunset that Solar generates. They differ by how many degrees the sun lies below the horizon:

  • Official (~0°)

  • Civil (6° below horizon)

  • Nautical (12° below horizon)

  • Astronomical (18° below horizon)

For more information, see https://www.timeanddate.com/astronomy/different-types-twilight.html

Convenience methods

Solar also comes packaged with some convenience methods:

// Whether the location specified by the `latitude` and `longitude` is in daytime on `date`
let isDaytime = solar.isDaytime

// Whether the location specified by the `latitude` and `longitude` is in nighttime on `date`
let isNighttime = solar.isNighttime

Installation

Solar is available through CocoaPods, Carthage, and Swift Package Manager.

CocoaPods

To include Solar in an application, add the following pod to your Podfile, then run pod install:

pod "Solar", "~> 2.2"

To include Solar in another pod, add the following dependency to your podspec:

s.dependency "Solar", "~> 2.2"

Carthage

Add the ceek/Solar project to your Cartfile, then follow the rest of Carthage’s XCFramework installation instructions:

github "ceeK/Solar" ~> 2.2

Swift Package Manager

To include Solar in an application in Xcode:

  1. Go to File ‣ Swift Packages ‣ Add Package Dependency.
  2. Enter https://github.com/ceeK/Solar.git as the package repository and click Next.
  3. Set Rules to Version, Up to Next Major, and enter 2.2.0 as the minimum version requirement. Click Next.

To include Solar in another Swift package, add the following dependency to your Package.swift:

.package(name: "Solar", url: "https://github.com/ceeK/Solar.git", from: "2.2.0")

License

The MIT License (MIT)

Copyright (c) 2016-2021 Chris Howell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].