Closed metasmile closed 6 years ago
and this is only for Swift4.2 as you know
@metasmile I'm a bit confused about this one, as these should be equivalent.
Does CIVector
have a static func called init
or something? I'm not sure if this a bug in SwiftFormat or some sort of weird edge-case.
In any case, you can fix it using:
// swiftformat:disable:next redundantInit
CIVector.init(float3x3: matrix)
@metasmile any update on this?
😅Oh Sorry, I've forgotten it. CIVector.init(float3x3: matrix) was an extension in my chaos-big codebase. But still I think every user can always useinit
extension. so we should find some smarter way for detecting the relationship with extensions.
btw, closed this issue at first.
@metasmile any update on this?
So anyway, is "SwiftFormatter" is real "formatter"? extension relationship is essential.
@metasmile SwiftFormat is confused by the use of init
as a function name, which is not common practice. It doesn't compile your project or look in other files beyond the one it's currently formatting, so doesn't know about extension methods that might have been added in another file.
The default rules that are enabled are ones that work for most projects. If that rule doesn't work for your prject, you can disable it for specific files or lines using a comment, or disable it completely for the whole project by adding --disable redundantInit
to the command line or inside a .swiftformat
file in your project.
If I can think of a way to automatically disable it for init
functions then I'll do that, but I don't think it's possible without radically changing how the formatter works.
This tool converts from
to
result: