Xcode 模板<<日期>>格式

发布于 2024-08-22 21:04:28 字数 681 浏览 4 评论 0 原文

我正在制作一个自定义 Xcode 模板,并且想更改 <> 的格式化方式。

例如:

//  Created by «FULLUSERNAME» on «DATE».
//  Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved.

如果文件是今天创建的,则将填写为:

//  Created by SooDesuNe on 2/24/2010.
//  Copyright 2010 MyOrganization. All rights reserved.

以任何“全数字”格式格式化的日期可能会导致很多混乱,因为 ISO 和 JIS 书写相同日期的方式是 24/2/2010。该月的 24 日天气晴朗,但该月的前 12 天不太清晰​​。

我希望 x-code 填充 <> ,如下所示:

//  Created by SooDesuNe on 24-Feb-2010.
//  Copyright 2010 MyOrganization. All rights reserved.

因为这样没有歧义。有人知道如何更改日期格式吗?

I'm working up a custom Xcode template, and I'd like to change the way <<date>> is formatted.

For example:

//  Created by «FULLUSERNAME» on «DATE».
//  Copyright «YEAR» «ORGANIZATIONNAME». All rights reserved.

if the file was created today would fill as:

//  Created by SooDesuNe on 2/24/2010.
//  Copyright 2010 MyOrganization. All rights reserved.

Dates formatted in any "all numbers" format can cause a lot of confusion, since the ISO and JIS way of writing the same date is 24/2/2010. It's clear on the 24th day of the month, but not so clear on the first 12 days of the month.

I would like x-code to populate <<date>> like:

//  Created by SooDesuNe on 24-Feb-2010.
//  Copyright 2010 MyOrganization. All rights reserved.

Since there is no ambiguity that way. Anyone know how to change the date format?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

停顿的约定 2024-08-29 21:04:28
defaults write com.apple.dt.xcode AppleICUDateFormatStrings '{ 1 = "d-MMM-y"; }'
defaults write com.apple.dt.xcode AppleICUDateFormatStrings '{ 1 = "d-MMM-y"; }'
悸初 2024-08-29 21:04:28

你可以在系统偏好设置中更改你的时间显示的短格式,然后重新启动xcode,默认的日期格式将被更改

You can just change your short format of your time displaying in system preferences., then restart xcode, the default date format will be changed

又怨 2024-08-29 21:04:28

如果您想显示默认的日期和用户名,您可以在 ___FILEBASENAME___.swift 文件中添加这两行,

// ___FILEBASENAMEASIDENTIFIER___
// Created by ___FULLUSERNAME___ on ___DATE___.

这将显示用户创建的文件名和当前日期。

但是,如果您想添加标题,您可以添加以下行

//___FILEHEADER___

结果将是:-

//
//  TestViewController.swift
//  MyProjectName
//
//  Created by Rashid on 28/12/2021.
// 

If you want to show the default Date and User name you can add these two lines in your ___FILEBASENAME___.swift file

// ___FILEBASENAMEASIDENTIFIER___
// Created by ___FULLUSERNAME___ on ___DATE___.

This will show the File name and created by the User and Current date.

However if you want to add the header you can add the below line

//___FILEHEADER___

Result will be:-

//
//  TestViewController.swift
//  MyProjectName
//
//  Created by Rashid on 28/12/2021.
// 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文