Skip to content

Private IBAction is reported as unused in SPM #1089

@SmallRedGollum

Description

@SmallRedGollum

Describe the bug
Private IBAction methods inside an SPM module are incorrectly reported as unused by Periphery
The issue reproduces on the latest version (3.6.0)

Steps to reproduce

  • Use Periphery 3.6.0

  • Analyze an SPM module containing a UIViewController with IBAction methods

  • Observe that private IBActions connected via Interface Builder are flagged as unused

Minimal reproducible example:
https://github.com/SmallRedGollum/PeripheryIBActionWarning/blob/main/Sources/PeripheryIBActionWarning/ViewController.swift

Scan

periphery scan --config "./periphery.yml" --skip-build --index-store-path "/path/DerivedData/PeripheryIBActionWarning/Index.noindex/DataStore"

Output

/path/PeripheryIBActionWarning/ViewController.swift:17:28: warning: Unused function 'onButtonDidTap()'

/path/PeripheryIBActionWarning/ViewController.swift:30:20: warning: Unused function 'onButtonDidTap2()'

Expected behavior
Private IBAction methods connected in Interface Builder should not be reported as unused

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions