使行更短:
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."].joined()
)
或者更好,使用 vacawama 的多线解决方案:
let message =
"""
You will be requested to Use %@ to Sign In. \
%@ doesn't share any information about you. \
The permission is required to post your Live Video.
"""
这是一个通用的解决方案,但并不真正适合,NSLocalizedString
因为它破坏了扫描本地化字符串的工具,例如genstrings
.
您的另一个解决方案是通过在该行之前添加一个禁用来关闭该行的警告:
// swiftlint:disable:next line_length
有关禁用 swiftlint 规则的完整详细信息,请参阅在代码中禁用规则。