Xcode 9.1 - Ambigous reference to member filter


I already experienced this issue in the past, I fixed it.

But today I just download the new Xcode version 9.1 and my App is not building anymore, I got :


Ambiguous reference to member 'filter'


I don't know why, this is not the piece of code I was working on. The app is building/compiling fine since weeks.

When I check the Release Note on the <a href="https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html" rel="nofollow">Official Apple Website</a>, I don't seem to find any reference to my issue.

So here is the piece of code that was working perfectly 2 hours ago :

var severeWeather: Results<SevereWeather>? var vigiArray = Array<SevereWeather>() var redCount: Int = 0 severeWeather = realm.objects(SevereWeather.self).filter(NSPredicate(format: "department != nil")) .sorted(byKeyPath: "departmentNumber") vigiArray = Array(severeWeather!) redCount = vigiArray.filter { $0.dangerLevels.filter { $0.level.value == 4 }.count > 0 }.count

What is wrong with my code ?


RealmCollection also has a filter method, which is implemented differently. For some reason, Swift compiler doesn't know which one it should refer.

What about this:

redCount = vigiArray.filter { return $0.dangerLevels.filter(NSPredicate(format: "%K == %@", "level.value", NSNumber(integerLiteral: 4))).count > 0 }.count

Instead of accessing each element in dangerLevels yourself, build Predicate and let realm do the job for you.

Replace your nest filter with this and it should be compiling just fine.


  • How to solve “fatal: relocations remain against allocatable but non-writable sections” while using J
  • What is the official release update URL for Aptana Studio 3.0?
  • LyX — Title, Abstract, Keywords Missing When Using Elsevier Class in View
  • Cross compiling Qt 5
  • Locating unmatched delimiters in Clojurescript
  • Defining a method whose return type is the singleton type of an argument of that method
  • 3D Math: Calculate Bank (Roll) angle from Look and Up orthogonal vectors
  • Open an application in a space using applescripts
  • Refactoring advice: maps to POJOs
  • What does certain JVM do after loading ByteCode into memory?
  • How can i dump blob fields from mysql tables
  • C# Excel interop - how to test if interop object is still working and performing a task?
  • how to populate a SQLite database and use that database in phonegap?
  • Why does java tzupdater add leap seconds?
  • UIAlertController button function not working
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • Typescript - Unable to get 'import' statement to function
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Recording logins for password protected directories
  • Is there any way to access browser form field suggestions from JavaScript?
  • Splitting given String into two variables - php
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • TFS: Get latest causes slow project reloading
  • Check if a string to interpolate provides expected placeholders
  • Validaiting emails with Net.Mail MailAddress
  • Trying to switch camera back to front but getting exception
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Javascript + PHP Encryption with pidCrypt
  • How can I estimate amount of memory left with calling System.gc()?
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Hits per day in Google Big Query
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • costura.fody for a dll that references another dll
  • Reading document lines to the user (python)
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal