OC自定义文档头部注释

1、创建文件 IDETemplateMacros.plist

2、向文件里添加内容FILEHEADER

  • 具体内容

     // 文 件 名:___FILENAME___
     // 
     // 版权所有:___COPYRIGHT___
     // 创 建 者:___FULLUSERNAME___ 
     // 创建日期:___DATE___.
     // 文档说明:
     // 修 改 人:
     // 修改日期:
     // 

3、前往文件夹

  • 通过将 IDETemplateMacros.plist 文件放置到不同的目录,其影响的范围也不同:
    • 只对当前 Project 指定的用户(username)有影响
      .xcodeproj/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
    • 对当前 Project 的所有成员有影响
      .xcodeproj/xcshareddata/IDETemplateMacros.plist
    • 对指定用户的 Workspace 下的 Project 有影响
      .xcworkspace/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
    • 对所有成员 Workspace 下的 Project 有影响
      .xcworkspace/xcshareddata/IDETemplateMacros.plist
    • 对 Xcode 所有创建的文件都有影响
      ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist

4、将IDETemplateMacros.plist移动到目录下, 新文件即生效

  • 效果图:

5、官方文档对应内容

  • COPYRIGHT
    A copyright string that uses the company name of the team for the project. If there is no company name, the string is blank.

    The example shows a copyright string when the company is set to “Apple”.

    Copyright © 2018 Apple. All rights reserved.

  • DATE
    The current date.

  • DEFAULTTOOLCHAINSWIFTVERSION
    The version of Swift used for the default toolchain.

  • FILEBASENAME
    The name of the current file without any extension.

  • FILEBASENAMEASIDENTIFIER
    The name of the current file encoded as a C identifier.

  • FILEHEADER
    The text placed at the top of every new text file.

  • FILENAME
    The full name of the current file.

  • FULLUSERNAME
    The full name of the current macOS user.

  • NSHUMANREADABLECOPYRIGHTPLIST
    The entry for the human readable copyright string in the Info.plist file of a macOS app target. The value of the macro must include the XML delimiters for the plist. For example, a valid value is:
    NSHumanReadableCopyright
    Copyright © 2018 Apple, Inc. All rights reserved.

Notice that the value includes a newline.

  • ORGANIZATIONNAME
    The name for your organization that appears in boilerplate text throughout your project folder. The organization name in your project isn’t the same as the organization name that you enter in App Store Connect.

  • PACKAGENAME
    The name of the package built by the current scheme.

  • PACKAGENAMEASIDENTIFIER
    A C-identifier encoded version of the package name built by the current scheme.

  • PRODUCTNAME
    The app name of the product built by the current scheme.

  • PROJECTNAME
    The name of the current project.

  • RUNNINGMACOSVERSION
    The version of macOS that is running Xcode.

  • TARGETNAME
    The name of the current target.

  • TIME
    The current time.

  • USERNAME
    The login name for the current macOS user.

  • UUID
    Returns a unique ID. The first time this macro is used, it generates the ID before returning it. You can use this macro to create multiple unique IDs by using a modifier. Each modifier returns an ID that is unique for that modifier. For example, the first time the UUID:firstPurpose modifier is used, the macro generates and returns a unique ID for that macro and modifier combination. Subsequent uses of the UUID:firstPurpose modifier return the same ID. Adding the UUID:secondPurpose modifier generates and returns a different ID that will be unique to UUID:secondPurpose, and different from the ID for UUID:firstPurpose.

  • WORKSPACENAME
    The name of the current workspace. If there is only one project open, then the name of the current project.

  • YEAR
    The current year as a four-digit number.


原文地址:https://www.cnblogs.com/CH520/p/9166831.html