diff --git a/DemoApp/DemoApp.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme b/DemoApp/DemoApp.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme new file mode 100644 index 0000000..d6c8f8e --- /dev/null +++ b/DemoApp/DemoApp.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/SnapshotPreviewsCore/ConformanceLookup.swift b/Sources/SnapshotPreviewsCore/ConformanceLookup.swift index 056b373..1347e95 100644 --- a/Sources/SnapshotPreviewsCore/ConformanceLookup.swift +++ b/Sources/SnapshotPreviewsCore/ConformanceLookup.swift @@ -49,6 +49,11 @@ private func parseConformance(conformance: UnsafePointer.offset(of: \.protocolDescriptor)!).advanced(by: descriptorOffset) let address = jumpPtr.load(as: UInt64.self) + + // Address will be 0 if the protocol is not available (such as only defined on a newer OS) + guard address != 0 else { + return nil + } let protoPtr = UnsafeRawPointer(bitPattern: UInt(address))! let proto = protoPtr.load(as: ProtocolDescriptor.self) let namePtr = protoPtr.advanced(by: MemoryLayout.offset(of: \.name)!).advanced(by: Int(proto.name)) diff --git a/Sources/SnapshotPreviewsCore/PrecisionModifier.swift b/Sources/SnapshotPreviewsCore/PrecisionModifier.swift index 13b8b7d..b98e535 100644 --- a/Sources/SnapshotPreviewsCore/PrecisionModifier.swift +++ b/Sources/SnapshotPreviewsCore/PrecisionModifier.swift @@ -9,7 +9,7 @@ import Foundation import SwiftUI public struct EmergePrecisionModifier: ViewModifier { - let precision: Float + let precision: Float? public func body(content: Content) -> some View { content @@ -17,7 +17,7 @@ public struct EmergePrecisionModifier: ViewModifier { } extension View { - public func emergeSnapshotPrecision(_ precision: Float) -> some View { + public func emergeSnapshotPrecision(_ precision: Float?) -> some View { modifier(EmergePrecisionModifier(precision: precision)) } }