3
3
//
4
4
// Based on: Point-Free, Unobtrusive runtime warnings for libraries (2022-01-03)
5
5
// https://www.pointfree.co/blog/posts/70-unobtrusive-runtime-warnings-for-libraries
6
+ //
7
+ // Slightly modified by Ole Begemann
6
8
7
9
#if DEBUG
8
10
import os
9
- import XCTestDynamicOverlay
10
11
11
12
// NB: Xcode runtime warnings offer a much better experience than traditional assertions and
12
13
// breakpoints, but Apple provides no means of creating custom runtime warnings ourselves.
28
29
}
29
30
return UnsafeMutableRawPointer ( mutating: #dsohandle)
30
31
} ( ) ,
31
- log: OSLog ( subsystem: " com.apple.runtime-issues " , category: " ComposableArchitecture " )
32
+ log: OSLog ( subsystem: " com.apple.runtime-issues " , category: " DebugLayout " )
32
33
)
33
34
#endif
34
35
@@ -42,17 +43,9 @@ func runtimeWarning(
42
43
) {
43
44
#if DEBUG
44
45
let message = message ( )
45
- if _XCTIsTesting {
46
- if let file = file, let line = line {
47
- XCTFail ( String ( format: " \( message) " , arguments: args ( ) ) , file: file, line: line)
48
- } else {
49
- XCTFail ( String ( format: " \( message) " , arguments: args ( ) ) )
50
- }
51
- } else {
52
- unsafeBitCast (
53
- os_log as ( OSLogType , UnsafeRawPointer , OSLog , StaticString , CVarArg . . . ) -> Void ,
54
- to: ( ( OSLogType, UnsafeRawPointer, OSLog, StaticString, [ CVarArg] ) - > Void) . self
55
- ) ( . fault, rw. dso, rw. log, message, args ( ) )
56
- }
46
+ unsafeBitCast (
47
+ os_log as ( OSLogType , UnsafeRawPointer , OSLog , StaticString , CVarArg . . . ) -> Void ,
48
+ to: ( ( OSLogType, UnsafeRawPointer, OSLog, StaticString, [ CVarArg] ) - > Void) . self
49
+ ) ( . fault, rw. dso, rw. log, message, args ( ) )
57
50
#endif
58
51
}
0 commit comments