diff --git a/Sources/KVKCalendar/CurrentLineView.swift b/Sources/KVKCalendar/CurrentLineView.swift index 05c18f5f..b173c994 100644 --- a/Sources/KVKCalendar/CurrentLineView.swift +++ b/Sources/KVKCalendar/CurrentLineView.swift @@ -82,7 +82,14 @@ extension CurrentLineView: CalendarSettingProtocol { timeLabel.textColor = style.timeline.currentLineHourColor timeLabel.font = style.timeline.currentLineHourFont - + + switch style.timeline.lineHourStyle { + case .withTime: + timeLabel.isHidden = false + case .onlyLine: + timeLabel.isHidden = true + } + timeLabel.frame = CGRect(x: 0, y: 0, width: style.timeline.currentLineHourWidth, height: frame.height) diff --git a/Sources/KVKCalendar/Style.swift b/Sources/KVKCalendar/Style.swift index c0e56a88..02bf56b8 100644 --- a/Sources/KVKCalendar/Style.swift +++ b/Sources/KVKCalendar/Style.swift @@ -170,6 +170,7 @@ public struct TimelineStyle { public var widthEventViewer: CGFloat? = nil public var showLineHourMode: CurrentLineHourShowMode = .today public var scrollLineHourMode: CurrentLineHourScrollMode = .today + public var lineHourStyle: CurrentLineHourStyle = .withTime public var currentLineHourFont: UIFont = .systemFont(ofSize: 12) public var currentLineHourColor: UIColor = .red public var currentLineHourDotSize: CGSize = CGSize(width: 5, height: 5) @@ -228,6 +229,11 @@ public struct TimelineStyle { case vertical, horizontal } + public enum CurrentLineHourStyle: Equatable { + case withTime + case onlyLine + } + public enum CurrentLineHourShowMode: Equatable { case always, today, forDate(Date), never @@ -862,6 +868,7 @@ extension TimelineStyle: Equatable { && compare(\.widthEventViewer) && compare(\.showLineHourMode) && compare(\.scrollLineHourMode) + && compare(\.lineHourStyle) && compare(\.currentLineHourFont) && compare(\.currentLineHourColor) && compare(\.currentLineHourDotSize) diff --git a/Sources/KVKCalendar/TimelineView.swift b/Sources/KVKCalendar/TimelineView.swift index 4f6542e5..8cd600a4 100644 --- a/Sources/KVKCalendar/TimelineView.swift +++ b/Sources/KVKCalendar/TimelineView.swift @@ -168,7 +168,7 @@ final class TimelineView: UIView, EventDateProtocol, CalendarTimer { self.currentLineView.valueHash = nextDate.kvkMinute.hashValue self.currentLineView.date = nextDate - if self.isDisplayedTimes { + if self.isDisplayedTimes && style.timeline.lineHourStyle == .withTime { if let timeNext = self.getTimelineLabel(hour: nextDate.kvkHour + 1) { timeNext.isHidden = self.currentLineView.frame.intersects(timeNext.frame) } @@ -196,7 +196,7 @@ final class TimelineView: UIView, EventDateProtocol, CalendarTimer { scrollView.addSubview(currentLineView) movingCurrentLineHour() - if isDisplayedTimes { + if isDisplayedTimes && style.timeline.lineHourStyle == .withTime { if let timeNext = getTimelineLabel(hour: date.kvkHour + 1) { timeNext.isHidden = currentLineView.frame.intersects(timeNext.frame) }