Dies ist das Problem:kann nicht von einer schnellen Erweiterung SUBSCRIPT
typealias Byte = UInt8
protocol ByteProtocol {}
extension UInt8: ByteProtocol {}
extension Array where Element: ByteProtocol {
subscript (index: Int) -> UInt8 {
return self[Int(index % self.count)]
}
}
Dies will mich ersäufen gibt, auch wenn es mathematisch unmöglich ist:
var p: [Byte] = [Byte]()
p.append(15)
print(p[10])
Also, was der Fehler ist hier? P.S. Vielen Dank für Ihre Antwort :)
Das 'Int' initializer Anruf redundant ist. – Alexander