serialNumber: String { get }
var productType: Int { get }
}
public class SerialNumber: SerialNumberType {
let serialNumber: String
let productType: Int
init() {
serialNumber = ""
productType = 0
}
}
public class ParsedSerialNumber: SerialNumber {
let building: String
let time: String
let color: String
override init() {
building = ""
time = ""
color = ""
super.init()
}
}
protocol DeviceType {
var serialNumber: SerialNumberType { get }
}
public class Device: DeviceType {
let serialNumber: ParsedSerialNumber
init() {
serialNumber = ParsedSerialNumber()
}
}
error: MyPlayground.playground:27:14: error: type 'Device' does not conform to protocol 'DeviceType'
public class Device: DeviceType {
^
MyPlayground.playground:28:9: note: candidate has non-matching type 'ParsedSerialNumber'
let serialNumber: ParsedSerialNumber
^
MyPlayground.playground:24:9: note: protocol requires property 'serialNumber' with type 'SerialNumberType'; do you want to add a stub?
var serialNumber: SerialNumberType { get }
^
а что не так?
У тебя ошибка, но свифт лол, угу
Обсуждают сегодня