Bug 32215 - CNContacts_PredicatesExtension may be more properly static methods on CNContact
Summary: CNContacts_PredicatesExtension may be more properly static methods on CNContact
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 8.99 (iOS9 previews)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-21 12:01 UTC by Larry O'Brien
Modified: 2015-07-28 10:42 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Larry O'Brien 2015-07-21 12:01:18 UTC
It seems that at least some of the CNContacts_PredicateExtensions are just factory methods:

        let predicate: NSPredicate = CNContact.predicateForContactsMatchingName("O'Brien")
        let keysToFetch = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactRelationsKey]
        let store = CNContactStore()
        let contacts = try store.unifiedContactsMatchingPredicate(predicate, keysToFetch: keysToFetch)

while we have them as extension methods:

        var namePredicate = (new CNContact()).GetPredicateForContacts ("O'Brien");
Comment 1 Sebastien Pouliot 2015-07-21 13:51:18 UTC
It sounds like all static selectors in categories should be handled this way.

We'll discuss this in a future team call 
https://trello.com/c/2z8FHb95/522-generator-static-members-in-category
Comment 2 Sebastien Pouliot 2015-07-28 10:42:36 UTC
Manually fixed in maccore/xcode7 99a500b215916890f53f51230b89428a1b50fc1e

The generator will be updated to issue warnings in such cases, so it will be easier to spot those ugly API.