scinfu/SwiftSoup

Issue with not valid syntax on property unwrapping

geraldkfzteile24 opened this issue · 1 comments

In the code snippet within Cleaner.swift:

if let headWhitelist, let dirtHead = dirtyDocument.head(), let cleanHead = clean.head() {
    // ...
}

The problem arises because the headWhitelist is included in the if let statement without an associated optional unwrapping expression. This is not valid in Swift's syntax. The correct approach is to either provide an initializer for each variable in an if let statement or to ensure that each variable is an optional being unwrapped.

The CI is failing because of it.

❌  /Users/runner/work/ios-app/ios-app/Pods/SwiftSoup/Sources/Cleaner.swift:36:29: variable binding in a condition requires an initializer

        if let headWhitelist, let dirtHead = dirtyDocument.head(), let cleanHead = clean.head() *** // frameset documents won't have a head. the clean doc will have empty head.

Suggested solution

if let headWhitelist = headWhitelist, let dirtHead = dirtyDocument.head(), let cleanHead = clean.head() {
    // ...
}

Upgrading the CI Xcode version to 14.3 solved the issue