I build up a little XCode project with SwiftUI and Core Data. I have one entity with two attributes "uri" and "name". I also have a FetchRequest which gives me the objects from the entity(variable for that is "items"). My goal is to check if there is an object from items which contains a string that match to the "uri". Important: I can't use loops!
Should look somehting like this:
if(items.uri.contains("Test")){
print("working")
}else{
print("error")
You can try:
if items.contains(where: { $0.uri == "Test" }) {
print("working")
} else {
print("error")
}