diff --git a/Sources/SkipFoundation/Data.swift b/Sources/SkipFoundation/Data.swift index 2e12a4b..8abac3c 100644 --- a/Sources/SkipFoundation/Data.swift +++ b/Sources/SkipFoundation/Data.swift @@ -9,7 +9,7 @@ public protocol DataProtocol { var platformData: PlatformData { get } } -public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, KotlinConverting, SwiftCustomBridged { +public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, Sequence, KotlinConverting, SwiftCustomBridged { public var platformValue: PlatformData public init(platformValue: PlatformData) { @@ -149,6 +149,10 @@ public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, K return Array(platformValue.map { $0.toUByte() }) } + public override var iterable: kotlin.collections.Iterable { + return platformValue.map { $0.toUByte() } + } + // Platform declaration clash: The following declarations have the same JVM signature ((Lskip/lib/Array;)V): //public init(_ bytes: [Int]) { // self.platformValue = PlatformData(size: bytes.count, init: { @@ -224,6 +228,8 @@ public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, K // public mutating func append(_ buffer: UnsafeBufferPointer) + // without declaring this, the contains() gets incorrectly marked with "override", which is incorrect for the Data type + // SKIP DECLARE: fun contains(other: Data): Boolean public func contains(_ other: Data) -> Bool { if (other.isEmpty) { return true