From bd4ef03fa49693a03a647cf9c8a77e78c130d6d6 Mon Sep 17 00:00:00 2001 From: Jesse Cox Date: Fri, 23 Feb 2024 16:32:19 -0600 Subject: [PATCH] Make EventKit Imports Explicit (#149) * Add PERMISSIONSWIFTUI_EVENT SwiftSetting definition to JMRemindersPermissionManager and JMCalendarPermissionManager target definitions. * Wrap EventPermissionManager, JMRemindersPermissionManager, and JMCalendarPermissionManager with PERMISSIONSWIFTUI_EVENT check --------- Co-authored-by: Jevon Mao --- Package.swift | 12 +++++++++--- .../PermissionManagers/EventPermissionManager.swift | 3 +++ .../JMCalendarPermissionManager.swift | 4 ++-- .../JMRemindersPermissionManager.swift | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Package.swift b/Package.swift index 2b0d6e3..a1cf476 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,10 @@ let permissionsTargets: [Target] = [ .target( name: "PermissionsSwiftUICalendar", dependencies: ["Introspect", "CorePermissionsSwiftUI"], - exclude: ["../../Tests/PermissionsSwiftUITests/__Snapshots__"] + exclude: ["../../Tests/PermissionsSwiftUITests/__Snapshots__"], + swiftSettings: [ + .define("PERMISSIONSWIFTUI_EVENT") + ] ), .target( name: "PermissionsSwiftUICamera", @@ -93,7 +96,10 @@ let permissionsTargets: [Target] = [ .target( name: "PermissionsSwiftUIReminder", dependencies: ["Introspect", "CorePermissionsSwiftUI"], - exclude: ["../../Tests/PermissionsSwiftUITests/__Snapshots__"] + exclude: ["../../Tests/PermissionsSwiftUITests/__Snapshots__"], + swiftSettings: [ + .define("PERMISSIONSWIFTUI_EVENT") + ] ), .target( name: "PermissionsSwiftUISpeech", @@ -142,4 +148,4 @@ let package = Package( ), ] + permissionsTargets -) +) \ No newline at end of file diff --git a/Sources/CorePermissionsSwiftUI/Model/PermissionManagers/EventPermissionManager.swift b/Sources/CorePermissionsSwiftUI/Model/PermissionManagers/EventPermissionManager.swift index 1928600..08d4cf8 100644 --- a/Sources/CorePermissionsSwiftUI/Model/PermissionManagers/EventPermissionManager.swift +++ b/Sources/CorePermissionsSwiftUI/Model/PermissionManagers/EventPermissionManager.swift @@ -6,6 +6,8 @@ // import Foundation + +#if !os(tvOS) && PERMISSIONSWIFTUI_EVENT import EventKit open class EventPermissionManager: PermissionManager { @@ -52,3 +54,4 @@ open class EventPermissionManager: PermissionManager { } } +#endif \ No newline at end of file diff --git a/Sources/PermissionsSwiftUICalendar/JMCalendarPermissionManager.swift b/Sources/PermissionsSwiftUICalendar/JMCalendarPermissionManager.swift index e333d49..b5a2639 100644 --- a/Sources/PermissionsSwiftUICalendar/JMCalendarPermissionManager.swift +++ b/Sources/PermissionsSwiftUICalendar/JMCalendarPermissionManager.swift @@ -5,8 +5,8 @@ // Created by Jevon Mao on 1/31/21. // -import UIKit -#if !os(tvOS) +import Foundation +#if !os(tvOS) && PERMISSIONSWIFTUI_EVENT import EventKit import CorePermissionsSwiftUI diff --git a/Sources/PermissionsSwiftUIReminder/JMRemindersPermissionManager.swift b/Sources/PermissionsSwiftUIReminder/JMRemindersPermissionManager.swift index d187fb0..546a6f5 100644 --- a/Sources/PermissionsSwiftUIReminder/JMRemindersPermissionManager.swift +++ b/Sources/PermissionsSwiftUIReminder/JMRemindersPermissionManager.swift @@ -6,7 +6,7 @@ // import Foundation -#if !os(tvOS) +#if !os(tvOS) && PERMISSIONSWIFTUI_EVENT import EventKit import CorePermissionsSwiftUI