kvyatkovskys / KVKCalendar

A most fully customization calendar for Apple platforms 📅

Home Page:https://kvyatkovskys.github.io/KVKCalendar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide EventViewer on non-iPhone devices

rakuyoMo opened this issue · comments

Describe the bug

There may be no good way to hide EventViewer at the moment. As far as I understand, style.timeline.widthEventViewer = nil is equivalent to hiding EventViewer because it is an optional value type, rather than widthEventViewer = 0.

But because of the following code:

if isAvailableEventViewer {
if UIApplication.shared.orientation.isPortrait {
timelineFrame.size.width = UIScreen.main.bounds.width * 0.5

It ignores widthEventViewer when the device is in portrait orientation, resulting in a meaningless blank space on the right side of timelinePage.

I think the following changes can be made:

- if isAvailableEventViewer {
+ if isAvailableEventViewer, let width = style.timeline.widthEventViewer {
     if UIApplication.shared.orientation.isPortrait {
         timelineFrame.size.width = UIScreen.main.bounds.width * 0.5
     } else {
-        timelineFrame.size.width -= style.timeline.widthEventViewer ?? 0
+        timelineFrame.size.width -= width
     }
}

If you approve of this modification, I can submit a PR.

Sorry, I misread this question, please ignore it