Reputation: 1429
using static var and instance var as the variable same name in Swift that will occur compiler error. why?
example:
protocol naming {
static var firstName: String { get }
var firstName: String { get }
}
class Employee: NSObject, naming {
class var firstName: String {
return "MyName"
}
var firstName: String {
return Employee.firstName
}
}
Upvotes: 1
Views: 206
Reputation: 535989
It's a bug. (One of several connected with static variables in protocols.) And in Swift 2.0, it's fixed.
Upvotes: 1