<commit_before>import SwiftUI

internal extension ViewType {
    struct OptionalContent {}
}

extension ViewType.OptionalContent: SingleViewContent {

    static func child(_ content: Content) throws -> Content {
        guard let child = try (content.view as? OptionalViewContentProvider)?.view() else {
            throw InspectionError.typeMismatch(content.view, OptionalViewContentProvider.self)
        }
        return try Inspector.unwrap(view: child, modifiers: [])
    }
}

// MARK: - Private

private protocol OptionalViewContentProvider {
    func view() throws -> Any
}

extension Optional: OptionalViewContentProvider {
    
    func view() throws -> Any {
        switch self {
        case let .some(view):
            return view
        case .none:
            throw InspectionError.viewNotFound(parent: Inspector.typeName(value: self as Any))
        }
    }
}<commit_msg>Rework OptionalContent unwrapping<commit_after>import SwiftUI

internal extension ViewType {
    struct OptionalContent {}
}

extension ViewType.OptionalContent: SingleViewContent {

    static func child(_ content: Content) throws -> Content {
        guard let child = try? Inspector.attribute(label: "some", value: content.view) else {
            throw InspectionError.viewNotFound(parent: Inspector.typeName(value: content.view as Any))
        }
        return try Inspector.unwrap(view: child, modifiers: [])
    }
}
{'fraction_non_alphanumeric': 0.08917197452229299, 'fraction_numerical': 0.0, 'mean_word_length': 3.1466275659824046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5707777', 'n_tokens_mistral': 372, 'n_tokens_neox': 361, 'n_words': 103}