4

I wanted that every *.swift files must have the required texts. Like so.. Required header text on swift file

If the developer forgets to add it or has inputted the wrong values swiftlint will give an error or warning upon compiling.

I have searched about file_header but somehow it doesnt work properly. Here is my swiftlint.yml configuration Swiftlint configuration yml file

otakuProgrammer
  • 298
  • 2
  • 12

1 Answers1

3

You can use: required_pattern

    file_header:
      required_pattern: |
                        \/\/
                        \/\/  .*?\.swift
                        \/\/  (PROJECT_NAME.*?|Unit Tests)
                        \/\/
                        \/\/  (Created by .*? on .*?)
                        \/\/  Copyright © \d{4} COPY_RIGHT_NAME\. All rights reserved\.
                        \/\/

replace PROJECT_NAME and COPY_RIGHT_NAME with your values or change the pattern

Amir Khorsandi
  • 3,542
  • 1
  • 34
  • 38