diff --git a/Package.swift b/Package.swift index ab6551f..a968d5e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.8 +// swift-tools-version:5.9 import PackageDescription @@ -6,6 +6,7 @@ let package = Package( name: "HorizonCalendar", platforms: [ .iOS(.v11), + .visionOS(.v1) ], products: [ .library(name: "HorizonCalendar", targets: ["HorizonCalendar"]), diff --git a/Sources/Public/ItemViews/DayView.swift b/Sources/Public/ItemViews/DayView.swift index e0775ce..425aadc 100644 --- a/Sources/Public/ItemViews/DayView.swift +++ b/Sources/Public/ItemViews/DayView.swift @@ -122,8 +122,10 @@ public final class DayView: UIView { case .enabled(let playsHapticsOnTouchDown, _) = invariantViewProperties.interaction, playsHapticsOnTouchDown { +#if os(iOS) feedbackGenerator = UISelectionFeedbackGenerator() feedbackGenerator?.prepare() +#endif } } @@ -131,16 +133,19 @@ public final class DayView: UIView { super.touchesEnded(touches, with: event) setHighlightLayerVisibility(isHidden: true, animated: true) - +#if os(iOS) feedbackGenerator?.selectionChanged() feedbackGenerator = nil +#endif } public override func touchesCancelled(_ touches: Set, with event: UIEvent?) { super.touchesCancelled(touches, with: event) setHighlightLayerVisibility(isHidden: true, animated: true) +#if os(iOS) feedbackGenerator = nil +#endif } // MARK: Fileprivate @@ -159,8 +164,10 @@ public final class DayView: UIView { private let highlightLayer: CAShapeLayer? private let label: UILabel +#if os(iOS) private var feedbackGenerator: UISelectionFeedbackGenerator? - +#endif + private func setHighlightLayerVisibility(isHidden: Bool, animated: Bool) { guard let highlightLayer else { return }