1

since apple is no longer supporting UIWebview, is it possible to have swift-lint warning for that.

How to make a custom UIWebview usage swift-lint warning or error.

vijeesh
  • 1,317
  • 1
  • 17
  • 32

1 Answers1

1

The sample for defining the custom rule is here (did not test it by myself, possibly the regex would require some rework). You can check sample from swiftlint provided on the page https://github.com/realm/SwiftLint, under the section Defining Custom Rules.

custom_rules:
  uiwebview_deprecated: # rule identifier
  included: ".*\\.swift" # regex that defines paths to include during linting. optional.
  excluded: ".*Test\\.swift" # regex that defines paths to exclude during linting. optional
  name: "UIWebView deprecated" # rule name. optional.
  regex: "(UIWebView)" # matching pattern
  capture_group: 0 # number of regex capture group to highlight the rule violation at. optional.
  match_kinds: # SyntaxKinds to match. optional.
    - comment
    - identifier
  message: "UIWebView are deprecated, use WKWebView instead." # violation message. optional.
  severity: error # violation severity. optional.
no_hiding_in_strings:
  regex: "(UIWebView)"
  match_kinds: string
kerim.ba
  • 276
  • 1
  • 8