Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 70ff2fd

Browse files
committed
Update 1.2.0
- seperate calendar components (normal, limited) - change directory structure - add public modifier to the calendar style properties (refs #15) - update README
1 parent a1ad633 commit 70ff2fd

File tree

11 files changed

+1441
-692
lines changed

11 files changed

+1441
-692
lines changed

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 33 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/YYCalendar/Base.lproj/Main.storyboard

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<constraints>
2828
<constraint firstAttribute="height" constant="40" id="dAw-Pi-aab"/>
2929
</constraints>
30-
<state key="normal" title="Show YYCalendar">
30+
<state key="normal" title="Show Normal Calendar">
3131
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
3232
</state>
3333
<connections>
@@ -52,39 +52,23 @@
5252
<constraints>
5353
<constraint firstAttribute="height" constant="40" id="Did-Af-aLK"/>
5454
</constraints>
55-
<state key="normal" title="Show YYCalendar (disable after today)">
55+
<state key="normal" title="Show Limited Calendar">
5656
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
5757
</state>
5858
<connections>
5959
<action selector="showCalendar2:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Ent-1k-B52"/>
6060
</connections>
6161
</button>
62-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Itb-Cl-UwP">
63-
<rect key="frame" x="46" y="332" width="283" height="40"/>
64-
<color key="backgroundColor" red="0.0" green="0.58980089430000004" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
65-
<constraints>
66-
<constraint firstAttribute="height" constant="40" id="xT7-Mb-u97"/>
67-
</constraints>
68-
<state key="normal" title="Show YYCalendar (limited period)">
69-
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
70-
</state>
71-
<connections>
72-
<action selector="showCalendar3:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="SO4-Nm-2ei"/>
73-
</connections>
74-
</button>
7562
</subviews>
7663
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7764
<constraints>
7865
<constraint firstAttribute="trailingMargin" secondItem="Q6e-Su-w08" secondAttribute="trailing" constant="30" id="1h4-ti-2ZF"/>
79-
<constraint firstAttribute="trailingMargin" secondItem="Itb-Cl-UwP" secondAttribute="trailing" constant="30" id="A1c-JA-bQn"/>
8066
<constraint firstItem="Xon-wd-1Pm" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="Fbm-NH-u4g"/>
8167
<constraint firstItem="zaX-cJ-bCm" firstAttribute="centerX" secondItem="kh9-bI-dsS" secondAttribute="centerX" id="PP5-gl-iTI"/>
8268
<constraint firstItem="Q6e-Su-w08" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="30" id="TTn-ZJ-2AC"/>
8369
<constraint firstItem="zaX-cJ-bCm" firstAttribute="top" secondItem="Xon-wd-1Pm" secondAttribute="bottom" constant="30" id="h1A-kY-C7T"/>
8470
<constraint firstAttribute="trailingMargin" secondItem="avE-zr-6kq" secondAttribute="trailing" constant="30" id="iYP-Yd-9ly"/>
85-
<constraint firstItem="Itb-Cl-UwP" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="30" id="oCc-2o-Uzh"/>
8671
<constraint firstItem="Xon-wd-1Pm" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" constant="50" id="oYP-a8-z7j"/>
87-
<constraint firstItem="Itb-Cl-UwP" firstAttribute="top" secondItem="Q6e-Su-w08" secondAttribute="bottom" constant="30" id="qDX-vN-b0i"/>
8872
<constraint firstItem="avE-zr-6kq" firstAttribute="top" secondItem="zaX-cJ-bCm" secondAttribute="bottom" constant="50" id="tI8-S5-REE"/>
8973
<constraint firstItem="Q6e-Su-w08" firstAttribute="top" secondItem="avE-zr-6kq" secondAttribute="bottom" constant="30" id="uQh-Cu-E3m"/>
9074
<constraint firstItem="avE-zr-6kq" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="30" id="z7N-1W-kFL"/>

Example/YYCalendar/ViewController.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,15 @@ class ViewController: UIViewController {
2323
}
2424

2525
@IBAction func showCalendar(_ sender: UIButton) {
26-
let calendar = YYCalendar(langType: .ENG, date: "07/01/2019", format: "MM/dd/yyyy", disableAfterToday: false) { date in
26+
let calendar = YYCalendar(normalCalendarLangType: .ENG, date: "07/01/2019", format: "MM/dd/yyyy") { (date) in
2727
self.selectedDateLabel.text = date
2828
}
2929

3030
calendar.show()
3131
}
3232

3333
@IBAction func showCalendar2(_ sender: UIButton) {
34-
let calendar = YYCalendar(langType: .KOR, date: "07/01/2019", format: "MM/dd/yyyy", disableAfterToday: true) { date in
35-
self.selectedDateLabel.text = date
36-
}
37-
38-
calendar.show()
39-
}
40-
41-
@IBAction func showCalendar3(_ sender: UIButton) {
42-
let calendar = YYCalendar(langType: .KOR, date: "07/05/2019", minDate: "07/05/2019", maxDate: "07/15/2019", format: "MM/dd/yyyy") { date in
34+
let calendar = YYCalendar(limitedCalendarLangType: .KOR, date: "07/10/2019", minDate: "07/05/2019", maxDate: "07/20/2019", format: "MM/dd/yyyy") { (date) in
4335
self.selectedDateLabel.text = date
4436
}
4537

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,47 @@ First of all, you can show the calendar as below:<br>
2727
> *you have to equate **format** of date parameter with format parameter.*
2828
2929
```swift
30-
let calendar = YYCalendar(langType: .ENG, date: "06/10/2019", format: "MM/dd/yyyy", disableAfterToday: false) { date in
30+
let calendar = YYCalendar(normalCalendarLangType: .ENG, date: "07/01/2019", format: "MM/dd/yyyy") { (date) in
3131
self.selectedDateLabel.text = date
3232
}
3333

3434
calendar.show()
3535
```
3636

37+
You can set calendar style properties (color, font, ...)
38+
39+
```swift
40+
calendar.dimmedBackgroundColor: UIColor = UIColor.black
41+
calendar.dimmedBackgroundAlpha: CGFloat = 0.5
42+
calendar.headerViewBackgroundColor: UIColor = Useful.getUIColor(245, 245, 245)
43+
calendar.bodyViewBackgroundColor: UIColor = Useful.getUIColor(255, 255, 255)
44+
calendar.sundayColor: UIColor = Useful.getUIColor(235, 61, 79)
45+
calendar.disabledSundayColor: UIColor = Useful.getUIColor(251, 197, 202)
46+
calendar.saturdayColor: UIColor = Useful.getUIColor(53, 113, 214)
47+
calendar.disabledSaturdayColor: UIColor = Useful.getUIColor(194, 212, 243)
48+
calendar.defaultDayColor: UIColor = Useful.getUIColor(51, 51, 51)
49+
calendar.disabledDefaultDayColor: UIColor = Useful.getUIColor(193, 193, 193)
50+
calendar.lineSeparatorColor: UIColor = Useful.getUIColor(233, 233, 233)
51+
calendar.headerLabelFont: UIFont = UIFont.systemFont(ofSize: 24)
52+
calendar.weekLabelFont: UIFont = UIFont.systemFont(ofSize: 16)
53+
calendar.dayLabelFont: UIFont = UIFont.systemFont(ofSize: 19)
54+
```
55+
3756
## Calendar Type
3857

3958
There are two types of calendar.
4059

41-
| calendarType | description |
60+
| Calendar Type | Description |
4261
|---|---|
4362
| normal | you can select all of the date periods |
4463
| limited | you can limit selectable date periods |
4564

4665
```swift
4766
// normal type
48-
init(langType type: LangType, date: String, format: String, disableAfterToday: Bool, completion selectHandler: SelectHandler?)
67+
init(normalCalendarLangType langType: LangType, date: String, format: String, completion: SelectHandler?)
4968

5069
// limited type
51-
init(langType type: LangType, date: String, minDate: String?, maxDate: String?, format: String, completion selectHandler: SelectHandler?)
70+
init(limitedCalendarLangType langType: LangType, date: String, minDate: String?, maxDate: String?, format: String, completion: SelectHandler?)
5271
```
5372

5473
![normalType_Sample](https://raw.githubusercontent.com/DevYeom/YYCalendar/master/ScreenShot/normal_type.png) ![limitedType_Sample](https://raw.githubusercontent.com/DevYeom/YYCalendar/master/ScreenShot/limited_type.png)

YYCalendar.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'YYCalendar'
11-
s.version = '1.1.0'
11+
s.version = '1.2.0'
1212
s.swift_version = '5.0'
1313
s.summary = 'Very Simple and Useful Calendar'
1414

YYCalendar/Classes/DayButton.swift renamed to YYCalendar/Classes/Components/DayButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class DayButton: UIButton {
3333
}
3434

3535
didSet {
36-
backgroundColor = isHighlighted ? selectedDayColor : UIColor.white
36+
backgroundColor = isHighlighted ? selectedDayColor : UIColor.clear
3737
titleLabel?.textColor = isHighlighted ? UIColor.white : beforeTextColor
3838
}
3939
}

0 commit comments

Comments
 (0)