Post

Replies

Boosts

Views

Activity

What is the difference between Data and [UInt8]?
When designing APIs that deal with byte-level data, is there a good reason to use Data as a buffer instead of [UInt8]? From what I understand, Arrays of trivial types like UInt8 are always stored contiguously in memory. But I also know even SwiftNIO uses its own ByteBuffer type instead of [UInt8]. What do these buffer types do differently, and am I giving up on valuable performance or safety by simply using [UInt8]?
3
0
2.2k
Mar ’22
Xcode 12 SPM: "target [...] referenced in product [...] could not be found"
In Xcode 12, I'm trying to add a package dependency to an Xcode project. Specifically, this is the swift-bson package from mongoDB - https://github.com/mongodb/swift-bson. When adding the dependency to the project using File -> Swift Packages -> Add Package Dependency, I can find the git repository just fine. But when I try to add it, I get an error with the following messages: [Complete] Fetching https://github.com/mongodb/swift-bson.git 0.6 seconds [Error] target 'bson' referenced in product 'bson' could not be found I'm new to packages so I might be misunderstanding how this feature is supposed to work, but I'm pretty sure this is what the docs say I should do. This might also be an Xcode 12 thing, I know they changed a couple of things related to packages. Tried: Creating my own package and adding this one as a dependency Switching project targets Adding to a specific target instead of the whole project Getting a different version of the package Can someone help shed some light on what might be wrong?
1
0
2.9k
Sep ’20