swiftlint

Swiftlint overriding project settings related to SPM

帅比萌擦擦* 提交于 2021-01-22 06:49:09
问题 I am running into a strange behavior with swiftlint autocorrect. My project uses a library imported through SPM. But when I run the linter, it changes settings like the following B4621A7323D0A90F00545ADE /* LibraryName in Frameworks */ = {isa = PBXBuildFile; productRef = B4621A7223D0A90F00545ADE /* LibraryName */; }; files = ( B4621A7323D0A90F00545ADE /* LibraryName in Frameworks */, packageProductDependencies = ( B4621A7223D0A90F00545ADE /* LibraryName */, packageReferences = (

Swiftlint overriding project settings related to SPM

人走茶凉 提交于 2021-01-22 06:47:06
问题 I am running into a strange behavior with swiftlint autocorrect. My project uses a library imported through SPM. But when I run the linter, it changes settings like the following B4621A7323D0A90F00545ADE /* LibraryName in Frameworks */ = {isa = PBXBuildFile; productRef = B4621A7223D0A90F00545ADE /* LibraryName */; }; files = ( B4621A7323D0A90F00545ADE /* LibraryName in Frameworks */, packageProductDependencies = ( B4621A7223D0A90F00545ADE /* LibraryName */, packageReferences = (

How to fix 'Line Length Violation: Line should be 120 characters or less' - SwiftLint

吃可爱长大的小学妹 提交于 2020-12-02 11:55:49
问题 How to fix Line Length Violation? Relevant part of alert message that isn't allowed due to Line Length Violation: message: NSLocalizedString("\nYou will be requested to Use %@ to Sign In. %@ doesn't share any information about you. The permission is required to post your Live Video.", ⚠ Line should be 120 characters or less: currently 208 characters (line_length) 回答1: Make the line shorter: message: NSLocalizedString( ["\nYou will be requested to Use %@ to Sign In. ", "%@ doesn't share any

How to fix 'Line Length Violation: Line should be 120 characters or less' - SwiftLint

安稳与你 提交于 2020-12-02 11:51:43
问题 How to fix Line Length Violation? Relevant part of alert message that isn't allowed due to Line Length Violation: message: NSLocalizedString("\nYou will be requested to Use %@ to Sign In. %@ doesn't share any information about you. The permission is required to post your Live Video.", ⚠ Line should be 120 characters or less: currently 208 characters (line_length) 回答1: Make the line shorter: message: NSLocalizedString( ["\nYou will be requested to Use %@ to Sign In. ", "%@ doesn't share any

How to fix 'Line Length Violation: Line should be 120 characters or less' - SwiftLint

老子叫甜甜 提交于 2020-12-02 11:51:03
问题 How to fix Line Length Violation? Relevant part of alert message that isn't allowed due to Line Length Violation: message: NSLocalizedString("\nYou will be requested to Use %@ to Sign In. %@ doesn't share any information about you. The permission is required to post your Live Video.", ⚠ Line should be 120 characters or less: currently 208 characters (line_length) 回答1: Make the line shorter: message: NSLocalizedString( ["\nYou will be requested to Use %@ to Sign In. ", "%@ doesn't share any

How to fix 'Line Length Violation: Line should be 120 characters or less' - SwiftLint

强颜欢笑 提交于 2020-12-02 11:49:30
问题 How to fix Line Length Violation? Relevant part of alert message that isn't allowed due to Line Length Violation: message: NSLocalizedString("\nYou will be requested to Use %@ to Sign In. %@ doesn't share any information about you. The permission is required to post your Live Video.", ⚠ Line should be 120 characters or less: currently 208 characters (line_length) 回答1: Make the line shorter: message: NSLocalizedString( ["\nYou will be requested to Use %@ to Sign In. ", "%@ doesn't share any

OC项目转Swift指南

ぃ、小莉子 提交于 2020-08-12 05:15:33
运行环境:Xcode 11.1 Swift5.0 最近参与的一个项目需要从Objective-C(以下简称OC)转到Swift,期间遇到了一些坑,于是有了这篇总结性的文档。 如果你也有将OC项目Swift化的需求,可以作为参考。 OC转Swift有一个大前提就是你要对Swift有一定的了解,熟悉Swift语法,最好是完整看过一遍官方的 Language Guide 。 转换的过程分自动化和手动转译,鉴于自动化工具的识别率不能让人满意,大部分情况都是需要手动转换的。 自动化工具 有一个比较好的自动化工具 Swiftify ,可以将OC文件甚至OC工程整个转成Swift,号称准确率能达到90%。我试用了一些免费版中的功能,但感觉效果并不理想,因为没有使用过付费版,所以也不好评价它就是不好。 Swiftify还有一个Xcode的插件 Swiftify for Xcode ,可以实现对选中代码和单文件的转化。这个插件还挺不错,对纯系统代码转化还算精确,但部分代码还存在一些识别问题,需要手动再修改。 手动Swift化 桥接文件 如果你是在项目中首次使用Swift代码,在添加Swift文件时,Xcode会提示你添加一个 .h 的桥接文件。如果不小心点了不添加还可以手动导入,就是自己手动生成一个 .h 文件,然后在 Build Settings > Swift Compiler -

项目转Swift指南

爷,独闯天下 提交于 2020-08-11 15:42:51
运行环境:Xcode 11.1 Swift5.0 最近参与的一个项目需要从Objective-C(以下简称OC)转到Swift,期间遇到了一些坑,于是有了这篇总结性的文档。如果你也有将OC项目Swift化的需求,可以作为参考。 OC转Swift有一个大前提就是你要对Swift有一定的了解,熟悉Swift语法,最好是完整看过一遍官方的 Language Guide 。 转换的过程分自动化和手动转译,鉴于自动化工具的识别率不能让人满意,大部分情况都是需要手动转换的。 自动化工具 有一个比较好的自动化工具 Swiftify ,可以将OC文件甚至OC工程整个转成Swift,号称准确率能达到90%。我试用了一些免费版中的功能,但感觉效果并不理想,因为没有使用过付费版,所以也不好评价它就是不好。 Swiftify还有一个Xcode的插件 Swiftify for Xcode ,可以实现对选中代码和单文件的转化。这个插件还挺不错,对纯系统代码转化还算精确,但部分代码还存在一些识别问题,需要手动再修改。 手动Swift化 桥接文件 如果你是在项目中首次使用Swift代码,在添加Swift文件时,Xcode会提示你添加一个 .h 的桥接文件。如果不小心点了不添加还可以手动导入,就是自己手动生成一个 .h 文件,然后在 Build Settings > Swift Compiler - General

OC项目转Swift指南

情到浓时终转凉″ 提交于 2020-07-27 13:53:49
运行环境:Xcode 11.1 Swift5.0 最近参与的一个项目需要从Objective-C(以下简称OC)转到Swift,期间遇到了一些坑,于是有了这篇总结性的文档。 如果你也有将OC项目Swift化的需求,可以作为参考。 OC转Swift有一个大前提就是你要对Swift有一定的了解,熟悉Swift语法,最好是完整看过一遍官方的 Language Guide 。 转换的过程分自动化和手动转译,鉴于自动化工具的识别率不能让人满意,大部分情况都是需要手动转换的。 自动化工具 有一个比较好的自动化工具 Swiftify ,可以将OC文件甚至OC工程整个转成Swift,号称准确率能达到90%。我试用了一些免费版中的功能,但感觉效果并不理想,因为没有使用过付费版,所以也不好评价它就是不好。 Swiftify还有一个Xcode的插件 Swiftify for Xcode ,可以实现对选中代码和单文件的转化。这个插件还挺不错,对纯系统代码转化还算精确,但部分代码还存在一些识别问题,需要手动再修改。 手动Swift化 桥接文件 如果你是在项目中首次使用Swift代码,在添加Swift文件时,Xcode会提示你添加一个 .h 的桥接文件。如果不小心点了不添加还可以手动导入,就是自己手动生成一个 .h 文件,然后在 Build Settings > Swift Compiler -

How to force error on SwiftLint instead of warnings?

别说谁变了你拦得住时间么 提交于 2020-02-03 23:42:40
问题 my question is very simple, how do I make all warnings become errors on SwiftLint? (without manually configuring each rule separately) 回答1: To integrate SwiftLint to your project, you normally need to add a Run Script Phase, as described by the doc. If you used the CocoaPods installation, this script would look like: "${PODS_ROOT}/SwiftLint/swiftlint" That is where you can customize the command line options. In your case, you may want to use: "${PODS_ROOT}/SwiftLint/swiftlint" lint --strict