From 323fb7fc82b45a096b4a46f10995369873b4df5d Mon Sep 17 00:00:00 2001 From: Bryan Keller Date: Thu, 15 Aug 2024 11:41:55 -0400 Subject: [PATCH] Add visibleMonthRange and visibleDayRange to proxy --- CHANGELOG.md | 1 + Sources/Public/CalendarViewProxy.swift | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7d46e..41d4eaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for disabling touch handling on SwiftUI views via the `allowsHitTesting` modifier - Added SwiftUI documentation to the README.md +- Added properties to `CalendarViewProxy` for getting the `visibleMonthRange` and `visibleDayRange` ### Fixed - Fixed an issue that could cause accessibility focus to shift unexpectedly diff --git a/Sources/Public/CalendarViewProxy.swift b/Sources/Public/CalendarViewProxy.swift index f30f8fb..b731bc4 100644 --- a/Sources/Public/CalendarViewProxy.swift +++ b/Sources/Public/CalendarViewProxy.swift @@ -26,6 +26,16 @@ public final class CalendarViewProxy: ObservableObject { // MARK: Public + /// The range of months that are partially of fully visible. + public var visibleMonthRange: MonthComponentsRange? { + calendarView.visibleMonthRange + } + + /// The range of months that are partially of fully visible. + public var visibleDayRange: DayComponentsRange? { + calendarView.visibleDayRange + } + /// Scrolls the calendar to the specified month with the specified position. /// /// If the calendar has a non-zero frame, this function will scroll to the specified month immediately. Otherwise the scroll-to-month