基于Lunar封装的iOS版本,支持Objective-C
和Swift
。
// Lunar
var d = Lunar.fromYmd(1986, 4, 21);
// Swift
var d = Lunar(year: 1986, month: 4, day: 21)
// OC
Lunar *d = [[Lunar alloc] initWithYear:1986 month:4 day:21];
// Lunar
var d = Lunar.fromYmd(1986, 4, 21);
d.toFullString()
// Swift
var d = Lunar(year: 1986, month: 4, day: 21)
d.toFullString()
// OC
Lunar *d = [[Lunar alloc] initWithYear:1986 month:4 day:21];
[d toFullString];
// Lunar
var holidays = HolidayUtil.getHolidays(2020);
console.log(holidays);
// Swift
var holidays = HolidayUtil.getHolidays(year: 2023)
print("\(holidays)")
To run the example project, clone the repo, and run pod install
from the Example directory first.
Add the following entry to your Podfile:
pod 'Lunar-iOS'
To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift
:
.package(url: "https://github.com/HouHangLei/Lunar-iOS.git", .upToNextMajor(from: "1.2.37.1"))
Lunar-iOS is available under the MIT license. See the LICENSE file for more info.