Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Sources/SkipFoundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public protocol DataProtocol {
var platformData: PlatformData { get }
}

public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, KotlinConverting<kotlin.ByteArray>, SwiftCustomBridged {
public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, Sequence, KotlinConverting<kotlin.ByteArray>, SwiftCustomBridged {
public var platformValue: PlatformData

public init(platformValue: PlatformData) {
Expand Down Expand Up @@ -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<UInt8> {
return platformValue.map { $0.toUByte() }
}

// Platform declaration clash: The following declarations have the same JVM signature (<init>(Lskip/lib/Array;)V):
//public init(_ bytes: [Int]) {
// self.platformValue = PlatformData(size: bytes.count, init: {
Expand Down Expand Up @@ -224,6 +228,8 @@ public struct Data : DataProtocol, Hashable, CustomStringConvertible, Codable, K

// public mutating func append<SourceType>(_ buffer: UnsafeBufferPointer<SourceType>)

// 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
Expand Down
Loading