Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger implicit_getter even if the getter is mutating #1589

Closed
rraphaeldev opened this issue May 31, 2017 · 2 comments
Closed

Trigger implicit_getter even if the getter is mutating #1589

rraphaeldev opened this issue May 31, 2017 · 2 comments

Comments

@rraphaeldev
Copy link

rraphaeldev commented May 31, 2017

In case of a mutating getter, the get keyword must be specified to add the mutating behavior but this trigger the implicit_getter warning.

struct Counter {
  private var count: Int
  
  init(start: Int = 0) {
    self.count = start
  }
  
  var next: Int? {
    mutating get { // warning: Implicit Getter Violation: Computed read-only properties should avoid using the get keyword. (implicit_getter)
      defer {
        self.count += 1
      }
      
      return self.count
    }
  }
}

Edit: swiftlint version: 0.19.0

@marcelofabri
Copy link
Collaborator

Similar to #1309

@marcelofabri
Copy link
Collaborator

Implemented in #1678.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants