For example:
class A {
var c = 0
func getAndIncCount() -> Int {
let v = c
c++
return v
}
}
Could be refactored as:
class A {
func getAndIncCount() -> Int {
instance var c = 0 // this instance variable for class A is only accessible in this method
let v = c
c++
return v
}
}