├── LunarCalendar
├── README.md
├── .gitignore
├── LunarCalendar
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── AccentColor.colorset
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Preview Content
│ │ └── Preview Assets.xcassets
│ │ │ └── Contents.json
│ ├── LunarCalendarApp.swift
│ ├── ContentView.swift
│ └── Info.plist
├── Tests
│ ├── LinuxMain.swift
│ └── LunarCalendarTests
│ │ ├── XCTestManifests.swift
│ │ └── LunarCalendarTests.swift
├── LunarCalendar.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── project.pbxproj
├── swift_package_init
├── Sources
│ └── LunarCalendar
│ │ ├── CalendarWeek.swift
│ │ ├── LunarCalendar.swift
│ │ ├── CalenderDay.swift
│ │ ├── Util.swift
│ │ └── CalendarGrid.swift
└── Package.swift
├── Image
├── 1.png
└── 2.gif
├── README.md
├── LICENSE
└── .gitignore
/LunarCalendar/README.md:
--------------------------------------------------------------------------------
1 | # LunarCalendar
2 |
3 | A description of this package.
4 |
--------------------------------------------------------------------------------
/Image/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjinhu/LunarCalendar-SwiftUI/HEAD/Image/1.png
--------------------------------------------------------------------------------
/Image/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zjinhu/LunarCalendar-SwiftUI/HEAD/Image/2.gif
--------------------------------------------------------------------------------
/LunarCalendar/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | /.build
3 | /Packages
4 | /*.xcodeproj
5 | xcuserdata/
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LunarCalendar-SwiftUI
2 | 符合中国使用习惯的农历日历,SwiftUI2.0
3 |
4 | 
5 |
6 | 
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/LunarCalendar/Tests/LinuxMain.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | import LunarCalendarTests
4 |
5 | var tests = [XCTestCaseEntry]()
6 | tests += LunarCalendarTests.allTests()
7 | XCTMain(tests)
8 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/LunarCalendar/Tests/LunarCalendarTests/XCTestManifests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | #if !canImport(ObjectiveC)
4 | public func allTests() -> [XCTestCaseEntry] {
5 | return [
6 | testCase(LunarCalendarTests.allTests),
7 | ]
8 | }
9 | #endif
10 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/LunarCalendarApp.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LunarCalendarApp.swift
3 | // LunarCalendar
4 | //
5 | // Created by iOS on 2021/1/21.
6 | //
7 |
8 | import SwiftUI
9 |
10 | @main
11 | struct LunarCalendarApp: App {
12 | var body: some Scene {
13 | WindowGroup {
14 | ContentView()
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/LunarCalendar/swift_package_init:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # 获取工程根目录
4 | fadir()
5 | {
6 | local this_dir=`pwd`
7 | local child_dir="$1"
8 | dirname "$child_dir"
9 | cd $this_dir
10 | }
11 | CUR_DIR=$(cd `dirname $0` && pwd -P )
12 |
13 | cd $CUR_DIR
14 |
15 | echo "当前文件路径 $CUR_DIR"
16 |
17 | swift package init
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/LunarCalendar/Tests/LunarCalendarTests/LunarCalendarTests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import LunarCalendar
3 |
4 | final class LunarCalendarTests: XCTestCase {
5 | func testExample() {
6 | // This is an example of a functional test case.
7 | // Use XCTAssert and related functions to verify your tests produce the correct
8 | // results.
9 | XCTAssertEqual(LunarCalendar().text, "Hello, World!")
10 | }
11 |
12 | static var allTests = [
13 | ("testExample", testExample),
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/LunarCalendar/Sources/LunarCalendar/CalendarWeek.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CalendarWeek.swift
3 | // CalendarCard
4 | //
5 | // Created by iOS on 2021/1/19.
6 | //
7 |
8 | import SwiftUI
9 |
10 | public struct CalendarWeek: View {
11 | public var body: some View {
12 | HStack{
13 | ForEach(1...7, id: \.self) { count in
14 | Text(Tool.getWeek(week: count))
15 | .frame(maxWidth: .infinity)
16 | }
17 | }
18 | .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
19 | }
20 | }
21 |
22 | struct CalendarWeek_Previews: PreviewProvider {
23 | static var previews: some View {
24 | CalendarWeek()
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // LunarCalendar
4 | //
5 | // Created by iOS on 2021/1/21.
6 | //
7 |
8 | import SwiftUI
9 |
10 | struct ContentView: View {
11 | @State var isPresented = false
12 | var body: some View {
13 |
14 | Button(action: {
15 | isPresented.toggle()
16 | }) {
17 | Text("弹出日历")
18 | }
19 | .padding(20.0)
20 | .sheet(isPresented: $isPresented) {
21 | LunarCalendar(select: { date in
22 | print("\(date)")
23 | })
24 | }
25 | }
26 | }
27 |
28 | struct ContentView_Previews: PreviewProvider {
29 | static var previews: some View {
30 | ContentView()
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 jinhu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LunarCalendar/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version:5.3
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "LunarCalendar",
8 | products: [
9 | // Products define the executables and libraries a package produces, and make them visible to other packages.
10 | .library(
11 | name: "LunarCalendar",
12 | targets: ["LunarCalendar"]),
13 | ],
14 | dependencies: [
15 | // Dependencies declare other packages that this package depends on.
16 | // .package(url: /* package url */, from: "1.0.0"),
17 | ],
18 | targets: [
19 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
20 | // Targets can depend on other targets in this package, and on products in packages this package depends on.
21 | .target(
22 | name: "LunarCalendar",
23 | dependencies: []),
24 | .testTarget(
25 | name: "LunarCalendarTests",
26 | dependencies: ["LunarCalendar"]),
27 | ]
28 | )
29 |
--------------------------------------------------------------------------------
/LunarCalendar/Sources/LunarCalendar/LunarCalendar.swift:
--------------------------------------------------------------------------------
1 |
2 | import SwiftUI
3 |
4 | public struct LunarCalendar : View{
5 | @Environment(\.calendar) var calendar
6 | @Environment(\.presentationMode) var mode
7 |
8 | private var year: DateInterval {
9 | calendar.dateInterval(of: .year, for: Date())!
10 | }
11 |
12 | private let onSelect: (Date) -> Void
13 |
14 | public init(select: @escaping (Date) -> Void) {
15 | self.onSelect = select
16 | }
17 |
18 | public var body: some View {
19 |
20 | VStack(alignment: .center, spacing: 0, content: {
21 | CalendarWeek()
22 | .frame(height: 30.0)
23 |
24 | CalendarGrid(interval: year) { date in
25 |
26 | CalenderDay(day: Tool.getDay(date: date),
27 | lunar: Tool.getInfo(date: date),
28 | isToday: calendar.isDateInToday(date),
29 | isWeekDay: Tool.isWeekDay(date: date))
30 | .onTapGesture {
31 | mode.wrappedValue.dismiss()
32 | DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
33 | self.onSelect(date)
34 | }
35 | }
36 | }
37 | })
38 | .padding([.leading, .trailing], 10.0)
39 |
40 | }
41 | }
42 |
43 | struct LunarCalendar_Previews: PreviewProvider {
44 | static var previews: some View {
45 | LunarCalendar(select: {_ in
46 |
47 | })
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 |
28 | UIApplicationSupportsIndirectInputEvents
29 |
30 | UILaunchScreen
31 |
32 | UIRequiredDeviceCapabilities
33 |
34 | armv7
35 |
36 | UISupportedInterfaceOrientations
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UISupportedInterfaceOrientations~ipad
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationPortraitUpsideDown
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/LunarCalendar/Sources/LunarCalendar/CalenderDay.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CalenderDay.swift
3 | // CalendarCard
4 | //
5 | // Created by iOS on 2021/1/20.
6 | //
7 |
8 | import SwiftUI
9 |
10 | struct CalenderDay: View {
11 |
12 | let day: String
13 | let lunar: String
14 | let isToday: Bool
15 | let isWeekDay: Bool
16 |
17 | var body: some View {
18 | ZStack{
19 | VStack{
20 |
21 | Text(day)
22 | .frame(width: 40, height: 40, alignment: .center)
23 | .font(.title)
24 | .foregroundColor(isWeekDay ? Color.red : Color.black)
25 |
26 | Text(lunar)
27 | .font(.footnote)
28 | .multilineTextAlignment(.center)
29 | .fixedSize(horizontal: true, vertical: false)
30 | .foregroundColor(isWeekDay ? Color.red : Color.gray)
31 | }
32 | .padding(.bottom, 5.0)
33 | .overlay(
34 | RoundedRectangle(cornerRadius: 5).stroke( isToday ? Color.orange : Color.clear, lineWidth: 2)
35 | )
36 |
37 | // VStack{
38 | // HStack{
39 | // Spacer()
40 | // ZStack{
41 | // Circle()
42 | // .frame(width: 15.0, height: 15.0)
43 | // .foregroundColor(Color.red)
44 | //
45 | // Text("休")
46 | // .font(.system(size: 10))
47 | // .fontWeight(.medium)
48 | // .padding(.all, 2.0)
49 | // .foregroundColor(.white)
50 | // }
51 | // }
52 | // Spacer()
53 | // }
54 |
55 | }
56 |
57 | }
58 |
59 | }
60 |
61 | struct CalenderDay_Previews: PreviewProvider {
62 | static var previews: some View {
63 | CalenderDay(day: "15", lunar: "腊八腊八", isToday: true, isWeekDay: true)
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## User settings
6 | xcuserdata/
7 |
8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
9 | *.xcscmblueprint
10 | *.xccheckout
11 |
12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
13 | build/
14 | DerivedData/
15 | *.moved-aside
16 | *.pbxuser
17 | !default.pbxuser
18 | *.mode1v3
19 | !default.mode1v3
20 | *.mode2v3
21 | !default.mode2v3
22 | *.perspectivev3
23 | !default.perspectivev3
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 |
28 | ## App packaging
29 | *.ipa
30 | *.dSYM.zip
31 | *.dSYM
32 |
33 | ## Playgrounds
34 | timeline.xctimeline
35 | playground.xcworkspace
36 |
37 | # Swift Package Manager
38 | #
39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
40 | # Packages/
41 | # Package.pins
42 | # Package.resolved
43 | # *.xcodeproj
44 | #
45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
46 | # hence it is not needed unless you have added a package configuration file to your project
47 | # .swiftpm
48 |
49 | .build/
50 |
51 | # CocoaPods
52 | #
53 | # We recommend against adding the Pods directory to your .gitignore. However
54 | # you should judge for yourself, the pros and cons are mentioned at:
55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
56 | #
57 | # Pods/
58 | #
59 | # Add this line if you want to avoid checking in source code from the Xcode workspace
60 | # *.xcworkspace
61 |
62 | # Carthage
63 | #
64 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
65 | # Carthage/Checkouts
66 |
67 | Carthage/Build/
68 |
69 | # Accio dependency management
70 | Dependencies/
71 | .accio/
72 |
73 | # fastlane
74 | #
75 | # It is recommended to not store the screenshots in the git repo.
76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed.
77 | # For more information about the recommended setup visit:
78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
79 |
80 | fastlane/report.xml
81 | fastlane/Preview.html
82 | fastlane/screenshots/**/*.png
83 | fastlane/test_output
84 |
85 | # Code Injection
86 | #
87 | # After new code Injection tools there's a generated folder /iOSInjectionProject
88 | # https://github.com/johnno1962/injectionforxcode
89 |
90 | iOSInjectionProject/
91 |
--------------------------------------------------------------------------------
/LunarCalendar/Sources/LunarCalendar/Util.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DateEx.swift
3 | // LunarCalendar
4 | //
5 | // Created by iOS on 2021/1/21.
6 | //
7 |
8 | import Foundation
9 |
10 | struct Tool {
11 |
12 | static func getWeek(week: Int) -> String{
13 | switch week {
14 | case 1:
15 | return "周一"
16 | case 2:
17 | return "周二"
18 | case 3:
19 | return "周三"
20 | case 4:
21 | return "周四"
22 | case 5:
23 | return "周五"
24 | case 6:
25 | return "周六"
26 | case 7:
27 | return "周日"
28 | default:
29 | return ""
30 | }
31 | }
32 |
33 | static let chineseHoliDay:[String:String] = ["1-1":"春节",
34 | "1-15":"元宵节",
35 | "2-2":"龙抬头",
36 | "5-5":"端午",
37 | "7-7":"七夕",
38 | "7-15":"中元",
39 | "8-15":"中秋",
40 | "9-9":"重阳",
41 | "12-8":"腊八",
42 | "12-23":"小年(北)",
43 | "12-24":"小年(南)",
44 | "12-30":"除夕"]
45 |
46 | static let gregorianHoliDay:[String:String] = ["1-1":"元旦",
47 | "2-14":"情人节",
48 | "3-8":"妇女节",
49 | "3-12":"植树节",
50 | "4-4":"清明",
51 | "5-1":"劳动节",
52 | "5-4":"青年节",
53 | "6-1":"儿童节",
54 | "7-1":"建党节",
55 | "8-1":"建军节",
56 | "10-1":"国庆",
57 | "12-24":"平安夜",
58 | "12-25":"圣诞节"]
59 |
60 | ///得到今天日期
61 | static func getDay(date: Date) -> String{
62 | return String(Calendar.current.component(.day, from: date))
63 | }
64 |
65 | ///获取农历, 节假日名
66 | static func getInfo(date: Date) -> String{
67 | //初始化农历日历
68 | let lunarCalendar = Calendar.init(identifier: .chinese)
69 |
70 | ///获得农历月
71 | let lunarMonth = DateFormatter()
72 | lunarMonth.locale = Locale(identifier: "zh_CN")
73 | lunarMonth.dateStyle = .medium
74 | lunarMonth.calendar = lunarCalendar
75 | lunarMonth.dateFormat = "MMM"
76 |
77 | let month = lunarMonth.string(from: date)
78 |
79 | //获得农历日
80 | let lunarDay = DateFormatter()
81 | lunarDay.locale = Locale(identifier: "zh_CN")
82 | lunarDay.dateStyle = .medium
83 | lunarDay.calendar = lunarCalendar
84 | lunarDay.dateFormat = "d"
85 |
86 | let day = lunarDay.string(from: date)
87 | ///生成公历日历的Key 用于查询字典
88 | let gregorianFormatter = DateFormatter()
89 | gregorianFormatter.locale = Locale(identifier: "zh_CN")
90 | gregorianFormatter.dateFormat = "M-d"
91 |
92 | let gregorian = gregorianFormatter.string(from: date)
93 |
94 | ///生成农历的key
95 | let lunarFormatter = DateFormatter()
96 | lunarFormatter.locale = Locale(identifier: "zh_CN")
97 | lunarFormatter.dateStyle = .short
98 | lunarFormatter.calendar = lunarCalendar
99 | lunarFormatter.dateFormat = "M-d"
100 |
101 | let lunar = lunarFormatter.string(from: date)
102 |
103 | ///如果是节假日返回节假日名称
104 | if let holiday = getHoliday(lunarKey: lunar, gregorKey: gregorian) {
105 | return holiday
106 | }
107 |
108 | //返回农历月
109 | if day == "初一" {
110 | return month
111 | }
112 |
113 | //返回农历日期
114 | return day
115 |
116 | }
117 |
118 | static func getHoliday(lunarKey: String, gregorKey: String) -> String?{
119 |
120 | ///当前农历节日优先返回
121 | if let holiday = chineseHoliDay[lunarKey]{
122 | return holiday
123 | }
124 |
125 | ///当前公历历节日返回
126 | if let holiday = gregorianHoliDay[gregorKey]{
127 | return holiday
128 | }
129 |
130 | return nil
131 | }
132 |
133 | static func isWeekDay(date: Date) -> Bool{
134 | switch date.getWeekDay() {
135 | case 7, 1:
136 | return true
137 | default:
138 | return false
139 | }
140 | }
141 | }
142 |
143 |
144 |
--------------------------------------------------------------------------------
/LunarCalendar/Sources/LunarCalendar/CalendarGrid.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CalendarView.swift
3 | // CalendarCard
4 | //
5 | // Created by iOS on 2021/1/18.
6 | //
7 |
8 | import SwiftUI
9 |
10 | public struct CalendarGrid: View where DateView: View {
11 | @Environment(\.calendar) var calendar
12 |
13 | let interval: DateInterval
14 | let showHeaders: Bool
15 | let content: (Date) -> DateView
16 |
17 | public init(interval: DateInterval, showHeaders: Bool = true, @ViewBuilder content: @escaping (Date) -> DateView) {
18 | self.interval = interval
19 | self.showHeaders = showHeaders
20 | self.content = content
21 | }
22 |
23 | public var body: some View {
24 | ///添加到可以滚动
25 | ScrollView(.vertical, showsIndicators: false){
26 | ///添加滚动监听
27 | ScrollViewReader { (proxy: ScrollViewProxy) in
28 | ///生成网格
29 | LazyVGrid(columns: Array(repeating: GridItem(spacing: 2, alignment: .center), count: 7)) {
30 | ///枚举每个月
31 | ForEach(months, id: \.self) { month in
32 | ///以每月为一个Section,添加月份
33 | Section(header: header(for: month)) {
34 | ///添加日
35 | ForEach(days(for: month), id: \.self) { date in
36 | ///如果不在当月就隐藏
37 | if calendar.isDate(date, equalTo: month, toGranularity: .month) {
38 | content(date).id(date)
39 | } else {
40 | content(date).hidden()
41 | }
42 | }
43 | }
44 | .id(sectionID(for: month))///给每个月创建ID,方便进行滚动标记
45 | }
46 | }
47 | .onAppear(){
48 | ///当View展示的时候直接滚动到标记好的月份
49 | proxy.scrollTo(scroolSectionID() )
50 | }
51 | }
52 | }
53 |
54 | }
55 | ///获取当前是几月,并进行滚动到那里
56 | private func scroolSectionID() -> Int {
57 | let component = calendar.component(.month, from: Date())
58 | return component
59 | }
60 | ///根据月份生成SectionID
61 | private func sectionID(for month: Date) -> Int {
62 | let component = calendar.component(.month, from: month)
63 | return component
64 | }
65 | ///获得年间距的月份日期的第一天,生成数组
66 | private var months: [Date] {
67 | calendar.generateDates(
68 | inside: interval,
69 | matching: DateComponents(day: 1, hour: 0, minute: 0, second: 0)
70 | )
71 | }
72 | ///创建一个简单的SectionHeader
73 | private func header(for month: Date) -> some View {
74 | let component = calendar.component(.month, from: month)
75 | let formatter = component == 1 ? DateFormatter.monthAndYear : .month
76 |
77 | return Group {
78 | if showHeaders {
79 | Text(formatter.string(from: month))
80 | .font(.title)
81 | .padding()
82 | }
83 | }
84 | }
85 | ///获取每个月,网格范围内的起始结束日期数组
86 | private func days(for month: Date) -> [Date] {
87 | ///重点讲解
88 | ///先拿到月份间距,例如1号--31号
89 | guard let monthInterval = calendar.dateInterval(of: .month, for: month) else { return [] }
90 | ///先获取第一天所在周的周一到周日
91 | let monthFirstWeek = monthInterval.start.getWeekStartAndEnd(isEnd: false)
92 | ///获取月最后一天所在周的周一到周日
93 | let monthLastWeek = monthInterval.end.getWeekStartAndEnd(isEnd: true)
94 | ///然后根据月初所在周的周一为0号row 到月末所在周的周日为最后一个row生成数组
95 | return calendar.generateDates(
96 | inside: DateInterval(start: monthFirstWeek.start, end: monthLastWeek.end),
97 | matching: DateComponents(hour: 0, minute: 0, second: 0)
98 | )
99 | }
100 |
101 | }
102 |
103 | struct CalendarView_Previews: PreviewProvider {
104 | static var previews: some View {
105 | CalendarGrid(interval: .init()) { _ in
106 | Text("30")
107 | .padding(8)
108 | .background(Color.blue)
109 | .cornerRadius(8)
110 | }
111 | }
112 | }
113 |
114 |
115 | extension Date {
116 |
117 | func getWeekDay() -> Int{
118 | let calendar = Calendar.current
119 | ///拿到现在的week数字
120 | let components = calendar.dateComponents([.weekday], from: self)
121 | return components.weekday!
122 | }
123 |
124 | ///获取当前Date所在周的周一到周日
125 | func getWeekStartAndEnd(isEnd: Bool) -> DateInterval{
126 | var date = self
127 | ///因为一周的起始日是周日,周日已经算是下一周了
128 | ///如果是周日就到退回去两天
129 | if isEnd {
130 | if date.getWeekDay() <= 2 {
131 | date = date.addingTimeInterval(-60 * 60 * 24 * 2)
132 | }
133 | }else{
134 | if date.getWeekDay() == 1 {
135 | date = date.addingTimeInterval(-60 * 60 * 24 * 2)
136 | }
137 | }
138 | ///使用处理后的日期拿到这一周的间距: 周日到周六
139 | let week = Calendar.current.dateInterval(of: .weekOfMonth, for: date)!
140 | ///处理一下周日加一天到周一
141 | let monday = week.start.addingTimeInterval(60 * 60 * 24)
142 | ///周六加一天到周日
143 | let sunday = week.end.addingTimeInterval(60 * 60 * 24)
144 | ///生成新的周一到周日的间距
145 | let interval = DateInterval(start: monday, end: sunday)
146 | return interval
147 | }
148 | }
149 |
150 | extension DateFormatter {
151 |
152 | static var month: DateFormatter {
153 | let formatter = DateFormatter()
154 | formatter.dateFormat = "M月"
155 | return formatter
156 | }
157 |
158 | static var monthAndYear: DateFormatter {
159 | let formatter = DateFormatter()
160 | formatter.dateFormat = "yyyy年M月"
161 | return formatter
162 | }
163 | }
164 |
165 | extension Calendar {
166 | func generateDates(inside interval: DateInterval, matching components: DateComponents) -> [Date] {
167 | var dates: [Date] = []
168 |
169 | dates.append(interval.start)
170 |
171 | enumerateDates(startingAfter: interval.start, matching: components, matchingPolicy: .nextTime) { date, _, stop in
172 | if let date = date {
173 | if date < interval.end {
174 | dates.append(date)
175 | } else {
176 | stop = true
177 | }
178 | }
179 | }
180 | return dates
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/LunarCalendar/LunarCalendar.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 816B2A0725B979AB0067C835 /* LunarCalendarApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A0625B979AB0067C835 /* LunarCalendarApp.swift */; };
11 | 816B2A0925B979AB0067C835 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A0825B979AB0067C835 /* ContentView.swift */; };
12 | 816B2A0B25B979AE0067C835 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 816B2A0A25B979AE0067C835 /* Assets.xcassets */; };
13 | 816B2A0E25B979AE0067C835 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 816B2A0D25B979AE0067C835 /* Preview Assets.xcassets */; };
14 | 816B2A1825B97A4B0067C835 /* LunarCalendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A1725B97A4B0067C835 /* LunarCalendar.swift */; };
15 | 816B2A1B25B97A970067C835 /* CalendarWeek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A1A25B97A970067C835 /* CalendarWeek.swift */; };
16 | 816B2A1E25B97AC00067C835 /* Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A1D25B97AC00067C835 /* Util.swift */; };
17 | 816B2A2225B97BD10067C835 /* CalendarGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A2125B97BD10067C835 /* CalendarGrid.swift */; };
18 | 816B2A2625B97F7F0067C835 /* CalenderDay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 816B2A2525B97F7F0067C835 /* CalenderDay.swift */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXFileReference section */
22 | 816B2A0325B979AB0067C835 /* LunarCalendar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LunarCalendar.app; sourceTree = BUILT_PRODUCTS_DIR; };
23 | 816B2A0625B979AB0067C835 /* LunarCalendarApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LunarCalendarApp.swift; sourceTree = ""; };
24 | 816B2A0825B979AB0067C835 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
25 | 816B2A0A25B979AE0067C835 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
26 | 816B2A0D25B979AE0067C835 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
27 | 816B2A0F25B979AE0067C835 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
28 | 816B2A1725B97A4B0067C835 /* LunarCalendar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LunarCalendar.swift; sourceTree = ""; };
29 | 816B2A1A25B97A970067C835 /* CalendarWeek.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarWeek.swift; sourceTree = ""; };
30 | 816B2A1D25B97AC00067C835 /* Util.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Util.swift; sourceTree = ""; };
31 | 816B2A2125B97BD10067C835 /* CalendarGrid.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarGrid.swift; sourceTree = ""; };
32 | 816B2A2525B97F7F0067C835 /* CalenderDay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalenderDay.swift; sourceTree = ""; };
33 | /* End PBXFileReference section */
34 |
35 | /* Begin PBXFrameworksBuildPhase section */
36 | 816B2A0025B979AB0067C835 /* Frameworks */ = {
37 | isa = PBXFrameworksBuildPhase;
38 | buildActionMask = 2147483647;
39 | files = (
40 | );
41 | runOnlyForDeploymentPostprocessing = 0;
42 | };
43 | /* End PBXFrameworksBuildPhase section */
44 |
45 | /* Begin PBXGroup section */
46 | 816B29FA25B979AB0067C835 = {
47 | isa = PBXGroup;
48 | children = (
49 | 816B2A0525B979AB0067C835 /* LunarCalendar */,
50 | 816B2A0425B979AB0067C835 /* Products */,
51 | );
52 | sourceTree = "";
53 | };
54 | 816B2A0425B979AB0067C835 /* Products */ = {
55 | isa = PBXGroup;
56 | children = (
57 | 816B2A0325B979AB0067C835 /* LunarCalendar.app */,
58 | );
59 | name = Products;
60 | sourceTree = "";
61 | };
62 | 816B2A0525B979AB0067C835 /* LunarCalendar */ = {
63 | isa = PBXGroup;
64 | children = (
65 | 816B2A0625B979AB0067C835 /* LunarCalendarApp.swift */,
66 | 816B2A0825B979AB0067C835 /* ContentView.swift */,
67 | 816B2A1625B97A4B0067C835 /* LunarCalendar */,
68 | 816B2A0A25B979AE0067C835 /* Assets.xcassets */,
69 | 816B2A0F25B979AE0067C835 /* Info.plist */,
70 | 816B2A0C25B979AE0067C835 /* Preview Content */,
71 | );
72 | path = LunarCalendar;
73 | sourceTree = "";
74 | };
75 | 816B2A0C25B979AE0067C835 /* Preview Content */ = {
76 | isa = PBXGroup;
77 | children = (
78 | 816B2A0D25B979AE0067C835 /* Preview Assets.xcassets */,
79 | );
80 | path = "Preview Content";
81 | sourceTree = "";
82 | };
83 | 816B2A1625B97A4B0067C835 /* LunarCalendar */ = {
84 | isa = PBXGroup;
85 | children = (
86 | 816B2A1725B97A4B0067C835 /* LunarCalendar.swift */,
87 | 816B2A2125B97BD10067C835 /* CalendarGrid.swift */,
88 | 816B2A1A25B97A970067C835 /* CalendarWeek.swift */,
89 | 816B2A2525B97F7F0067C835 /* CalenderDay.swift */,
90 | 816B2A1D25B97AC00067C835 /* Util.swift */,
91 | );
92 | name = LunarCalendar;
93 | path = Sources/LunarCalendar;
94 | sourceTree = SOURCE_ROOT;
95 | };
96 | /* End PBXGroup section */
97 |
98 | /* Begin PBXNativeTarget section */
99 | 816B2A0225B979AB0067C835 /* LunarCalendar */ = {
100 | isa = PBXNativeTarget;
101 | buildConfigurationList = 816B2A1225B979AE0067C835 /* Build configuration list for PBXNativeTarget "LunarCalendar" */;
102 | buildPhases = (
103 | 816B29FF25B979AB0067C835 /* Sources */,
104 | 816B2A0025B979AB0067C835 /* Frameworks */,
105 | 816B2A0125B979AB0067C835 /* Resources */,
106 | );
107 | buildRules = (
108 | );
109 | dependencies = (
110 | );
111 | name = LunarCalendar;
112 | productName = LunarCalendar;
113 | productReference = 816B2A0325B979AB0067C835 /* LunarCalendar.app */;
114 | productType = "com.apple.product-type.application";
115 | };
116 | /* End PBXNativeTarget section */
117 |
118 | /* Begin PBXProject section */
119 | 816B29FB25B979AB0067C835 /* Project object */ = {
120 | isa = PBXProject;
121 | attributes = {
122 | LastSwiftUpdateCheck = 1230;
123 | LastUpgradeCheck = 1230;
124 | TargetAttributes = {
125 | 816B2A0225B979AB0067C835 = {
126 | CreatedOnToolsVersion = 12.3;
127 | };
128 | };
129 | };
130 | buildConfigurationList = 816B29FE25B979AB0067C835 /* Build configuration list for PBXProject "LunarCalendar" */;
131 | compatibilityVersion = "Xcode 9.3";
132 | developmentRegion = en;
133 | hasScannedForEncodings = 0;
134 | knownRegions = (
135 | en,
136 | Base,
137 | );
138 | mainGroup = 816B29FA25B979AB0067C835;
139 | productRefGroup = 816B2A0425B979AB0067C835 /* Products */;
140 | projectDirPath = "";
141 | projectRoot = "";
142 | targets = (
143 | 816B2A0225B979AB0067C835 /* LunarCalendar */,
144 | );
145 | };
146 | /* End PBXProject section */
147 |
148 | /* Begin PBXResourcesBuildPhase section */
149 | 816B2A0125B979AB0067C835 /* Resources */ = {
150 | isa = PBXResourcesBuildPhase;
151 | buildActionMask = 2147483647;
152 | files = (
153 | 816B2A0E25B979AE0067C835 /* Preview Assets.xcassets in Resources */,
154 | 816B2A0B25B979AE0067C835 /* Assets.xcassets in Resources */,
155 | );
156 | runOnlyForDeploymentPostprocessing = 0;
157 | };
158 | /* End PBXResourcesBuildPhase section */
159 |
160 | /* Begin PBXSourcesBuildPhase section */
161 | 816B29FF25B979AB0067C835 /* Sources */ = {
162 | isa = PBXSourcesBuildPhase;
163 | buildActionMask = 2147483647;
164 | files = (
165 | 816B2A1825B97A4B0067C835 /* LunarCalendar.swift in Sources */,
166 | 816B2A2625B97F7F0067C835 /* CalenderDay.swift in Sources */,
167 | 816B2A1E25B97AC00067C835 /* Util.swift in Sources */,
168 | 816B2A2225B97BD10067C835 /* CalendarGrid.swift in Sources */,
169 | 816B2A0925B979AB0067C835 /* ContentView.swift in Sources */,
170 | 816B2A0725B979AB0067C835 /* LunarCalendarApp.swift in Sources */,
171 | 816B2A1B25B97A970067C835 /* CalendarWeek.swift in Sources */,
172 | );
173 | runOnlyForDeploymentPostprocessing = 0;
174 | };
175 | /* End PBXSourcesBuildPhase section */
176 |
177 | /* Begin XCBuildConfiguration section */
178 | 816B2A1025B979AE0067C835 /* Debug */ = {
179 | isa = XCBuildConfiguration;
180 | buildSettings = {
181 | ALWAYS_SEARCH_USER_PATHS = NO;
182 | CLANG_ANALYZER_NONNULL = YES;
183 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
184 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
185 | CLANG_CXX_LIBRARY = "libc++";
186 | CLANG_ENABLE_MODULES = YES;
187 | CLANG_ENABLE_OBJC_ARC = YES;
188 | CLANG_ENABLE_OBJC_WEAK = YES;
189 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
190 | CLANG_WARN_BOOL_CONVERSION = YES;
191 | CLANG_WARN_COMMA = YES;
192 | CLANG_WARN_CONSTANT_CONVERSION = YES;
193 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
194 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
195 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
196 | CLANG_WARN_EMPTY_BODY = YES;
197 | CLANG_WARN_ENUM_CONVERSION = YES;
198 | CLANG_WARN_INFINITE_RECURSION = YES;
199 | CLANG_WARN_INT_CONVERSION = YES;
200 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
201 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
202 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
203 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
204 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
205 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
206 | CLANG_WARN_STRICT_PROTOTYPES = YES;
207 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
208 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
209 | CLANG_WARN_UNREACHABLE_CODE = YES;
210 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
211 | COPY_PHASE_STRIP = NO;
212 | DEBUG_INFORMATION_FORMAT = dwarf;
213 | ENABLE_STRICT_OBJC_MSGSEND = YES;
214 | ENABLE_TESTABILITY = YES;
215 | GCC_C_LANGUAGE_STANDARD = gnu11;
216 | GCC_DYNAMIC_NO_PIC = NO;
217 | GCC_NO_COMMON_BLOCKS = YES;
218 | GCC_OPTIMIZATION_LEVEL = 0;
219 | GCC_PREPROCESSOR_DEFINITIONS = (
220 | "DEBUG=1",
221 | "$(inherited)",
222 | );
223 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
224 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
225 | GCC_WARN_UNDECLARED_SELECTOR = YES;
226 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
227 | GCC_WARN_UNUSED_FUNCTION = YES;
228 | GCC_WARN_UNUSED_VARIABLE = YES;
229 | IPHONEOS_DEPLOYMENT_TARGET = 14.3;
230 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
231 | MTL_FAST_MATH = YES;
232 | ONLY_ACTIVE_ARCH = YES;
233 | SDKROOT = iphoneos;
234 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
235 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
236 | };
237 | name = Debug;
238 | };
239 | 816B2A1125B979AE0067C835 /* Release */ = {
240 | isa = XCBuildConfiguration;
241 | buildSettings = {
242 | ALWAYS_SEARCH_USER_PATHS = NO;
243 | CLANG_ANALYZER_NONNULL = YES;
244 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
245 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
246 | CLANG_CXX_LIBRARY = "libc++";
247 | CLANG_ENABLE_MODULES = YES;
248 | CLANG_ENABLE_OBJC_ARC = YES;
249 | CLANG_ENABLE_OBJC_WEAK = YES;
250 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
251 | CLANG_WARN_BOOL_CONVERSION = YES;
252 | CLANG_WARN_COMMA = YES;
253 | CLANG_WARN_CONSTANT_CONVERSION = YES;
254 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
255 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
256 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
257 | CLANG_WARN_EMPTY_BODY = YES;
258 | CLANG_WARN_ENUM_CONVERSION = YES;
259 | CLANG_WARN_INFINITE_RECURSION = YES;
260 | CLANG_WARN_INT_CONVERSION = YES;
261 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
262 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
263 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
265 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
266 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
267 | CLANG_WARN_STRICT_PROTOTYPES = YES;
268 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
269 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
270 | CLANG_WARN_UNREACHABLE_CODE = YES;
271 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
272 | COPY_PHASE_STRIP = NO;
273 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
274 | ENABLE_NS_ASSERTIONS = NO;
275 | ENABLE_STRICT_OBJC_MSGSEND = YES;
276 | GCC_C_LANGUAGE_STANDARD = gnu11;
277 | GCC_NO_COMMON_BLOCKS = YES;
278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
280 | GCC_WARN_UNDECLARED_SELECTOR = YES;
281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
282 | GCC_WARN_UNUSED_FUNCTION = YES;
283 | GCC_WARN_UNUSED_VARIABLE = YES;
284 | IPHONEOS_DEPLOYMENT_TARGET = 14.3;
285 | MTL_ENABLE_DEBUG_INFO = NO;
286 | MTL_FAST_MATH = YES;
287 | SDKROOT = iphoneos;
288 | SWIFT_COMPILATION_MODE = wholemodule;
289 | SWIFT_OPTIMIZATION_LEVEL = "-O";
290 | VALIDATE_PRODUCT = YES;
291 | };
292 | name = Release;
293 | };
294 | 816B2A1325B979AE0067C835 /* Debug */ = {
295 | isa = XCBuildConfiguration;
296 | buildSettings = {
297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
298 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
299 | CODE_SIGN_STYLE = Automatic;
300 | DEVELOPMENT_ASSET_PATHS = "\"LunarCalendar/Preview Content\"";
301 | DEVELOPMENT_TEAM = 69LR4SZVY2;
302 | ENABLE_PREVIEWS = YES;
303 | INFOPLIST_FILE = LunarCalendar/Info.plist;
304 | IPHONEOS_DEPLOYMENT_TARGET = 14.0;
305 | LD_RUNPATH_SEARCH_PATHS = (
306 | "$(inherited)",
307 | "@executable_path/Frameworks",
308 | );
309 | PRODUCT_BUNDLE_IDENTIFIER = hu.LunarCalendar;
310 | PRODUCT_NAME = "$(TARGET_NAME)";
311 | SWIFT_VERSION = 5.0;
312 | TARGETED_DEVICE_FAMILY = "1,2";
313 | };
314 | name = Debug;
315 | };
316 | 816B2A1425B979AE0067C835 /* Release */ = {
317 | isa = XCBuildConfiguration;
318 | buildSettings = {
319 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
320 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
321 | CODE_SIGN_STYLE = Automatic;
322 | DEVELOPMENT_ASSET_PATHS = "\"LunarCalendar/Preview Content\"";
323 | DEVELOPMENT_TEAM = 69LR4SZVY2;
324 | ENABLE_PREVIEWS = YES;
325 | INFOPLIST_FILE = LunarCalendar/Info.plist;
326 | IPHONEOS_DEPLOYMENT_TARGET = 14.0;
327 | LD_RUNPATH_SEARCH_PATHS = (
328 | "$(inherited)",
329 | "@executable_path/Frameworks",
330 | );
331 | PRODUCT_BUNDLE_IDENTIFIER = hu.LunarCalendar;
332 | PRODUCT_NAME = "$(TARGET_NAME)";
333 | SWIFT_VERSION = 5.0;
334 | TARGETED_DEVICE_FAMILY = "1,2";
335 | };
336 | name = Release;
337 | };
338 | /* End XCBuildConfiguration section */
339 |
340 | /* Begin XCConfigurationList section */
341 | 816B29FE25B979AB0067C835 /* Build configuration list for PBXProject "LunarCalendar" */ = {
342 | isa = XCConfigurationList;
343 | buildConfigurations = (
344 | 816B2A1025B979AE0067C835 /* Debug */,
345 | 816B2A1125B979AE0067C835 /* Release */,
346 | );
347 | defaultConfigurationIsVisible = 0;
348 | defaultConfigurationName = Release;
349 | };
350 | 816B2A1225B979AE0067C835 /* Build configuration list for PBXNativeTarget "LunarCalendar" */ = {
351 | isa = XCConfigurationList;
352 | buildConfigurations = (
353 | 816B2A1325B979AE0067C835 /* Debug */,
354 | 816B2A1425B979AE0067C835 /* Release */,
355 | );
356 | defaultConfigurationIsVisible = 0;
357 | defaultConfigurationName = Release;
358 | };
359 | /* End XCConfigurationList section */
360 | };
361 | rootObject = 816B29FB25B979AB0067C835 /* Project object */;
362 | }
363 |
--------------------------------------------------------------------------------