Skip to content

Rule Request: "Legacy UIGraphics functions" #6268

@DimDL

Description

@DimDL

We could have a legacy_uigraphics_functions, which can already be defined as a custom rule:

custom_rules:
  legacy_uigraphics_functions:
    included: ".*\\.swift"
    name: "Legacy UIGraphics functions"
    regex: "(UIGraphicsBeginImageContextWithOptions|UIGraphicsBeginImageContext|UIGraphicsGetImageFromCurrentImageContext|UIGraphicsEndImageContext)\\s*\\("
    message: "This UIGraphics method is deprecated. Use UIGraphicsImageRenderer and related APIs instead."
    severity: warning

These 4 methods are already marked API_TO_BE_DEPRECATED in UIKit Headers.
This new rule would match existing SwiftLint rule such as legacy_cggeometry_functions and legacy_nsgeometry_functions

  1. configurable: no
  2. opt-in: yes, to match existing rules legacy_*_functions ? The replacement API (UIGraphicsImageRenderer) exists since iOS 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    rule-requestRequests for a new rules.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions