Commit 3b8258a 1 parent 4063527 commit 3b8258a Copy full SHA for 3b8258a
File tree 3 files changed +14
-21
lines changed
Demo/ButtonKitDemo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
Sources/ButtonKit/Trigger
3 files changed +14
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -9,13 +9,8 @@ let package = Package(
9
9
products: [
10
10
. library( name: " ButtonKit " , targets: [ " ButtonKit " ] ) ,
11
11
] ,
12
- dependencies: [
13
- . package ( url: " https://github.com/pointfreeco/swift-issue-reporting " , from: " 1.2.0 " )
14
- ] ,
15
12
targets: [
16
- . target( name: " ButtonKit " , dependencies: [
17
- . product( name: " IssueReporting " , package : " swift-issue-reporting " )
18
- ] ) ,
13
+ . target( name: " ButtonKit " ) ,
19
14
] ,
20
15
swiftLanguageVersions: [ . v6]
21
16
)
Original file line number Diff line number Diff line change 26
26
//
27
27
28
28
import SwiftUI
29
+
30
+ #if canImport(IssueReporting)
29
31
import IssueReporting
32
+ #else
33
+ import OSLog
34
+ #endif
30
35
31
36
/// Allow to trigger an arbitrary but identified `AsyncButton` or `ThrowableButton`
32
37
public final class TriggerButton : Sendable {
@@ -37,7 +42,11 @@ public final class TriggerButton: Sendable {
37
42
@MainActor
38
43
public func callAsFunction( id: AnyHashable ) {
39
44
guard let closure = buttons [ id] else {
45
+ #if canImport(IssueReporting)
40
46
reportIssue ( " Could not trigger button with id: \( id) . It is not currently on screen! " )
47
+ #else
48
+ Logger ( subsystem: " ButtonKit " , category: " Trigger " ) . warning ( " Could not trigger button with id: \( id) . It is not currently on screen! " )
49
+ #endif
41
50
return
42
51
}
43
52
closure ( )
@@ -46,7 +55,11 @@ public final class TriggerButton: Sendable {
46
55
@MainActor
47
56
func register( id: AnyHashable , action: @escaping @MainActor ( ) -> Void ) {
48
57
if buttons. keys. contains ( id) {
58
+ #if canImport(IssueReporting)
49
59
reportIssue ( " Registering a button with an already existing id: \( id) . The previous one was overridden. " )
60
+ #else
61
+ Logger ( subsystem: " ButtonKit " , category: " Trigger " ) . warning ( " Registering a button with an already existing id: \( id) . The previous one was overridden. " )
62
+ #endif
50
63
}
51
64
buttons. updateValue ( action, forKey: id)
52
65
}
You can’t perform that action at this time.
0 commit comments