How to write predicate to express not-in for compound index?

SELECT * 
FROM accounts 
WHERE (platform, innerID) NOT IN (
    ('platform_value1', 'innerID_value1'),
    ('platform_value2', 'innerID_value2'),
    ...
);

this is hard to use Swift Predicate:

    func _fetchAccountNotIn(_ scope: [Account]) throws -> [Account] {
        let scope = scope.map{ ($0.platform, $0.innerID) }
        return try fetch(.init(predicate: #Predicate<Account> { !scope.contains(($0.platform, $0.innerID)) }))
    }

shows compiler error: Cannot convert value of type '(String, String)' to expected argument type '((String, String)) throws -> Bool'

Account definition:

@Model
public final class Account {
    
    #Unique<Account>([\.platform, \.innerID])
    #Index<Account>([\.platform, \.innerID])

    @Attribute(.preserveValueOnDeletion)
    public private(set) var platform    : String
    
    @Attribute(.preserveValueOnDeletion)
    public private(set) var innerID     : String
}

I haven't used the Predicate macro myself, but the reason for the error message seems to be that tuples aren't Equatable and therefore the Sequence.contains(_: Element) overload is not available. You need to use contains(where:) instead.

This should do it:

#Predicate<Account> { account in
    !scope.contains { s in s == (account.platform, account.innerID) }
}

(A slightly better solution might now be to omit the let scope = … line and construct the scope tuple directly in the contains closure.)