|ReleasedLast Release||May 2017|
Maintained by Michał Nierebiński.
|LOCLines of Code||89|
Supported Swift version: Swift 3.0+
Supported platforms: iOS 9.0+, macOS 10.9+, tvOS 10.0+, watchOS 3.0, Ubuntu 14+
DateOfEaster is an extension for the
Date class, used for calcutation of Easter date, both western (used by Roman Catholic Church and many protestant and evangelical churches) and eastern (used by most of Eastern Orthodox Churches and Ancient Churches of the East).
You can also find eastern and western Pentecost plus Corpus Christi and Ash Wednesday dates with DateOfEaster.
Sometimes I need to find a certain Christian festive day’s date. A long ago I created a Ruby gem for this: when_easter. Now I thought to create something like this in Swift.
DateOfEaster is Swift Package Manager compatible. Add following to your
import PackageDescription let package = Package( [...] dependencies: [ .Package(url: "https://github.com/Loyolny/DateOfEaster.git", majorVersion: versionNumber) ] )
You can also build DateOfEaster as a framework for iOS, macOS, tvOS or watchOS. After building it, drag the created .framework file into your Xcode project.
DateOfEaster.swift file into your project
Find a western Easter date:
import DateOfEaster let westernEaster2015 = Date.westernEasterDate(year: 2015)
Find an eastern Easter date:
import DateOfEaster let easter1983 = Date.easternEasterDate(year: 1983)
Find Pentecost dates:
import DateOfEaster let lastYearsEasternPentecost = Date.easternPentecostDate(year: 2016)
Find Corpus Christi date for this year:
let year = Calendar.current.dateComponents([.year], from: Date()).year let thisYearsCorpusChristi = Date.corpusChristiDate(year: year)
Find Ash Wednesday date for this year:
let year = Calendar.current.dateComponents([.year], from: Date()).year let thisYearsCorpusChristi = Date.ashWednesdayDate(year: year)
Date optional. Both eastern and western date calcutation are subject to certain limitations:
Otherwise both functions will return nil.
There are iOS, macOS ,tvOS and watchOS frameworks in
# Clone the repository $ https://github.com/Loyolny/DateOfEaster.git # Enter the directory $ cd DateOfEaster # Install pod dependencies $ pod Install # Open the workspace file $ open DateOfEaster.xcworkspace
A playground is included in the project for you to learn how to use this library. Just build
DateOfEaster iOS target and play!
Both Easter date calcutation algorithms were taken from Wikipedia:
DateOfEaster includes a suite of tests for all functions of the library. They are tested with Xcode for iOS, macOS and tvOS. They were also run with Swift compiler under macOS and Ubuntu 14.
This project is distributed under a MIT license. See the LICENSE file for details.
DateOfEaster was created by Michał Nierebiński