10
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

user13538171
  • 101
  • 1
  • 3
  • `var x: CGFloat { get { origin.x } set { origin.x = newValue } }` should work. If you look at the Non Triggering Examples at the link you have [posted it is shown at the first example – Leo Dabus May 14 '20 at 03:28

1 Answers1

1

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.

bscothern
  • 1,894
  • 11
  • 15