Skip to content
Discussion options

You must be logged in to vote

Hi @mario-luis-dev, this is not currently possible and it is not planned. It is worth noting the very sharp edges of @Attribute(.externalStorage) and why we are hesitant to recreate it exactly as it exists in SwiftData.

Consider a model with data that does not store it externally:

@Model
final class Item {
  var asset: Data
  // …
}

With this kind of model it is totally fine to search for an item that matches some specific bytes:

let bytes = Data()

#Predicate { item in
  item.asset == bytes
}

This kind of query compiles, and can be executed just fine at runtime.

However, if we change the model like so:

@Model
final class Item {
  @Attribute(.externalStorage)
  var asset: Data
  // …
}

T…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mario-luis-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants