Skip to content

Commit

Permalink
Fix Swift 6 warning (#83)
Browse files Browse the repository at this point in the history
* Fix Swift 6 warning

* Update RuntimeWarning.swift
  • Loading branch information
stephencelis authored Jun 12, 2024
1 parent 6d1046c commit d834052
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Sources/Perception/Internal/RuntimeWarning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ func runtimeWarn(
// To work around this, we hook into SwiftUI's runtime issue delivery mechanism, instead.
//
// Feedback filed: https://gist.github.com/stephencelis/a8d06383ed6ccde3e5ef5d1b3ad52bbc
@usableFromInline
let dso = { () -> UnsafeMutableRawPointer in
#if swift(>=5.10)
@usableFromInline
nonisolated(unsafe) let dso = getSwiftUIDSO()
#else
@usableFromInline
let dso = getSwiftUIDSO()
#endif

private func getSwiftUIDSO() -> UnsafeMutableRawPointer {
let count = _dyld_image_count()
for i in 0..<count {
if let name = _dyld_get_image_name(i) {
Expand All @@ -53,7 +60,7 @@ func runtimeWarn(
}
}
return UnsafeMutableRawPointer(mutating: #dsohandle)
}()
}
#else
import Foundation

Expand Down

0 comments on commit d834052

Please sign in to comment.