From d8340521e532cffdf75a64468ff9362de8bd2bb9 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Wed, 12 Jun 2024 11:12:16 -0700 Subject: [PATCH] Fix Swift 6 warning (#83) * Fix Swift 6 warning * Update RuntimeWarning.swift --- Sources/Perception/Internal/RuntimeWarning.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Sources/Perception/Internal/RuntimeWarning.swift b/Sources/Perception/Internal/RuntimeWarning.swift index 44ea5f2..a2f10da 100644 --- a/Sources/Perception/Internal/RuntimeWarning.swift +++ b/Sources/Perception/Internal/RuntimeWarning.swift @@ -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..