Open mildm8nnered opened 1 year ago
Tracked in Apple’s issue tracker as rdar://126948248
So we actually re-implemented this rule in SwiftLint - see https://github.com/realm/SwiftLint/pull/4812
That implementation covers the case mentioned here, but also fixes a bunch of other cases. The unit test examples there should give some idea of additional coverage that swift-format does not have.
The UseSynthesizedInitializer initialiser does not seem to cover default initializers - only memberwise ones.
See https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization/#Default-Initializers
and
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization/#Memberwise-Initializers-for-Structure-Types
In code like this:
the
init() { }
can be omitted, as it will be synthesized.Classes will also get default initialisers under certain conditions.