SwiftLint get "implicit_getter" warning in overriding getter in Swift

Viewed 5042
extension CGRect {
    var x: CGFloat {
        set { self.origin.x = newValue }
        get { return self.origin.x } > got warning this line
    }
}

warning:

Implicit Getter Violation: Computed read-only properties should avoid using the get keyword. (implicit_getter)

Swiftlint Docs has no Example

https://realm.github.io/SwiftLint/implicit_getter.html

How can I solve this warning? Except ignore

1 Answers

Try swapping your get and set locations so the get is first. It is normal for gets to come before sets so I imagine swiftlint is only working for that case.

Related