Comparing two arrays in swift and removing elements with specific fields that don't match
<p>I have two arrays:</p>

<pre><code>var packages = [SAPackage]()
var inappProducts = [SKProduct]()
</code></pre>

<p>The SAPackage object in the packages array has a String var titled sku. TheSKProduct object in the inappProducts array has a String var titled productIdentifier. What I want to do is remove any object in the packages array that doesn't have a sku String that matches any objects productIdentifier String in the inappProducts array. Is there anyway to go about this? Thought about using sets to find an intersection however I cannot examine individual object fields doing this just whole objects. Any pointers on this would be greatly appreciated!</p>