Swiftlint: valid_ibinspectable requires explicit types

Created on 7 May 2019  路  2Comments  路  Source: realm/SwiftLint

New Issue Checklist

Describe the bug

valid_ibinspectable requires explicit types.

Swiftlint fires warning here:
@IBInspectable public var isSimulatingBarButtonItem = false

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint

warning: Valid IBInspectable Violation: @IBInspectable should be applied to variables only, have its type explicit and be of a supported type (valid_ibinspectable)

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.32.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Via package file from releases assets

  • Are you using nested configurations? no

  • Which Xcode version are you using (check xcode-select -p)? Version 10.2.1 (10E1001)
// This triggers a violation:
import UIKit

public final class CloseButton: UIButton {
    @IBInspectable public var isSimulatingBarButtonItem = false
}

Most helpful comment

Adding public like @IBInspectable public var cornerRadius: CGFloat or public extension UIView { solved warning for me

All 2 comments

Interface Builder requires to add type explicitly in other case this property is not displayed as custom attribute.

Adding public like @IBInspectable public var cornerRadius: CGFloat or public extension UIView { solved warning for me

Was this page helpful?
0 / 5 - 0 ratings