ViewController (Lint/ProhibitedInterfaceBuilderRule.swift)

SwiftLint · Source/SwiftLintBuiltInRules/Rules/Lint/ProhibitedInterfaceBuilderRule.swift · swift · MIT
ui, tag:embed-classified

SwiftLint rule that flags @IBOutlet and @IBAction usage to discourage Interface Builder.

// Source: https://github.com/realm/SwiftLint | License: MIT | Copyright 2025 The SwiftLint Contributors
// Provided via justclaw.it.com; keep this notice with the code.
import SwiftLintCore
import SwiftSyntax

@SwiftSyntaxRule(optIn: true)
struct ProhibitedInterfaceBuilderRule: Rule {
    var configuration = SeverityConfiguration<Self>(.warning)

    static let description = RuleDescription(
        identifier: "prohibited_interface_builder",
        name: "Prohibited Interface Builder",
        description: "Creating views using Interface Builder should be avoided",
        kind: .lint,
        nonTriggeringExamples: #examples([
            wrapExample("var label: UILabel!"),
            wrapExample("@objc func buttonTapped(_ sender: UIButton) {}"),
        ]),
        triggeringExamples

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key