diff --git a/Sources/ViewInspector/SwiftUI/ActionSheet.swift b/Sources/ViewInspector/SwiftUI/ActionSheet.swift index d15173b2..b6b4bfe3 100644 --- a/Sources/ViewInspector/SwiftUI/ActionSheet.swift +++ b/Sources/ViewInspector/SwiftUI/ActionSheet.swift @@ -124,8 +124,9 @@ extension ViewType.ActionSheet: SupplementaryChildren { return try InspectableView( content, parent: parent, call: "title()") case 1: - let view = try Inspector.attribute(path: "sheet|message", value: parent.content.view, type: Text?.self) - guard let view = view else { + let maybeView = try Inspector.attribute( + path: "sheet|message", value: parent.content.view, type: Text?.self) + guard let view = maybeView else { throw InspectionError.viewNotFound(parent: "message") } let content = try Inspector.unwrap(content: Content(view, medium: medium)) diff --git a/Sources/ViewInspector/SwiftUI/Alert.swift b/Sources/ViewInspector/SwiftUI/Alert.swift index 0740cc19..8b5cf7bf 100644 --- a/Sources/ViewInspector/SwiftUI/Alert.swift +++ b/Sources/ViewInspector/SwiftUI/Alert.swift @@ -120,8 +120,9 @@ extension ViewType.Alert: SupplementaryChildren { return try InspectableView( content, parent: parent, call: "title()") case 1: - let view = try Inspector.attribute(path: "alert|message", value: parent.content.view, type: Text?.self) - guard let view = view else { + let maybeView = try Inspector.attribute( + path: "alert|message", value: parent.content.view, type: Text?.self) + guard let view = maybeView else { throw InspectionError.viewNotFound(parent: "message") } let content = try Inspector.unwrap(content: Content(view, medium: medium)) @@ -133,9 +134,9 @@ extension ViewType.Alert: SupplementaryChildren { return try InspectableView( content, parent: parent, call: "primaryButton()") default: - let view = try Inspector.attribute( + let maybeView = try Inspector.attribute( path: "alert|secondaryButton", value: parent.content.view, type: Alert.Button?.self) - guard let view = view else { + guard let view = maybeView else { throw InspectionError.viewNotFound(parent: "secondaryButton") } let content = try Inspector.unwrap(content: Content(view, medium: medium)) diff --git a/ViewInspector.podspec b/ViewInspector.podspec index c6cc8544..a87abbde 100644 --- a/ViewInspector.podspec +++ b/ViewInspector.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = "ViewInspector" - s.version = "0.7.6" + s.version = "0.7.7" s.summary = "ViewInspector is a library for unit testing SwiftUI views." s.homepage = "https://github.com/nalexn/ViewInspector" s.license = { :type => "MIT", :file => "LICENSE" }