Unused Setter Value

Setter value is not used

  • Identifier: unused_setter_value
  • Enabled by default: Yes
  • Supports autocorrection: No
  • Kind: lint
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

var aValue: String {
    get {
        return Persister.shared.aValue
    }
    set {
        Persister.shared.aValue = newValue
    }
}
var aValue: String {
    set {
        Persister.shared.aValue = newValue
    }
    get {
        return Persister.shared.aValue
    }
}
var aValue: String {
    get {
        return Persister.shared.aValue
    }
    set(value) {
        Persister.shared.aValue = value
    }
}
override var aValue: String {
 get {
     return Persister.shared.aValue
 }
 set { }
}

Triggering Examples

var aValue: String {
    get {
        return Persister.shared.aValue
    }
    set {
        Persister.shared.aValue = aValue
    }
}
var aValue: String {
    set {
        Persister.shared.aValue = aValue
    }
    get {
        return Persister.shared.aValue
    }
}
var aValue: String {
    get {
        return Persister.shared.aValue
    }
    set {
        Persister.shared.aValue = aValue
    }
}
var aValue: String {
    get {
        let newValue = Persister.shared.aValue
        return newValue
    }
    set {
        Persister.shared.aValue = aValue
    }
}
var aValue: String {
    get {
        return Persister.shared.aValue
    }
    set(value) {
        Persister.shared.aValue = aValue
    }
}
override var aValue: String {
    get {
        return Persister.shared.aValue
    }
    set {
        Persister.shared.aValue = aValue
    }
}