Swiftlint: Weak delegates not correctly identified with Swift 4.1

Created on 25 Jan 2018  路  9Comments  路  Source: realm/SwiftLint

New Issue Checklist

With Swift 4.1 that came out with Xcode 9.3 beta, the weak delegates don't seem to be identified correctly.

Linting Swift files in current working directory
Linting 'atest.swift' (1/1)
/Users/barden/projects/DTI/swiftlint-test/atest.swift:10:8: warning: Weak Delegate Violation: Delegates should be weak to avoid reference cycles. (weak_delegate)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.24.2
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    homebrew

  • Which Xcode version are you using (check xcode-select -p)?

/Applications/Xcode-9.3.app/Contents/Developer (9.3 beta from 24th Jan)

  • Do you have a sample that shows the issue?
protocol TestDelegate: class {

}

protocol TestProtocol {
  weak var delegate: TestDelegate? { get }
}

class Test {
  weak var delegate: TestDelegate
}

Here there is the sourkitten structure output as well.

bug

Most helpful comment

Apparently it is still an issue. Happens on the Xcode 9.3 release. Installed through Coocapods.

All 9 comments

Thanks :)

Apparently it is still an issue. Happens on the Xcode 9.3 release. Installed through Coocapods.

@MillerApps please fill a new issue following the issue template

@marcelofabri looks like the pod for SwiftLint was out of date.

Yes I have the same issue on Xcode 9.3

Seeing this issue as well

Please open a new issue following the template and making sure you're on the latest version of SwiftLint.

also facing similar issue, just updated my Xcode to 9.3. any solution suggested thus far?

Make sure you have the latest swiftlint: swiftlint version. Should 0.25.1 by now.

Was this page helpful?
0 / 5 - 0 ratings