lyft / xiblint

A tool for linting storyboard and xib files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unavailable system classes rule

lujordan124 opened this issue · comments

I'm trying incorporate xiblint in an app, and was having trouble getting the unavailable_system_classes rule to work. From the code, it looks like we just include a system_classes key, with the objects we're looking for.
I currently have something like

{
    "rules":[unavailable_system_classes]
    "system_classes": {
        "button": ["MyModule.RandomButtonClass"]
    }
}

shouldn't it looks for buttons in the xibs that don't have customClass set to RandomButtonClass? I looked in the xib code, and they have button tags, but i'm unable to produce any xiblint errors

You want something like this:

{
  "rules": [
    "unavailable_custom_classes"
  ],
  "rules_config": {
    "unavailable_custom_classes": {
      "custom_classes": {
        "MyModule.RandomButtonClass": "MyModule.CorrectButtonClass",
      }
    }
  }
}

MyModule.CorrectButtonClass is what the error will tell you to use instead.

Use unavailable_system_classes for classes in UIKit (since those are stored differently in XIBs).

Make sense?

I believe I want system classes, since I'm trying to look for UIButton, and replace with a subclass. From your structure, I'm trying

{
    "rules":[unavailable_system_classes]
    "unavailable_system_classes": {
        "system_classes": {
            "UIButton": ["MyModule.RandomButtonClass"]
        }
    }
}

Does this work for you?

{
  "rules": [
    "unavailable_system_classes"
  ],
  "rules_config": {
    "unavailable_system_classes": {
      "system_classes": {
        "button": ["MyModule.RandomButtonClass"]
      }
    }
  }
}

We are using navigationController and navigationBar as the keys in our configuration. If so, I'll update the documentation!

Ahh, I thought from MyModule.RandomClassButton, I was supposed to use the class name there. The one your posted works. Thanks!