[swift-evolution] [Proposal] Type safe NSPredicate

Jerome ALVES j.alves at me.com
Wed Apr 27 08:32:44 CDT 2016


Hi everyone,

I think we all agree that #selector(...) and #keyPath(...) are great to write safe Swift code when interoperating with these Objective-C patterns.

How complicated would it be to have a similar functionality to write type safe NSPredicates ?

class Test {
    var value: Int = 0
}

let test = Test()
let myPredicate = #predicate(myValue == 3)

myPredicate.evaluateWithObject(test) // => false

test.value = 3

myPredicate.evaluateWithObject(test) // => true


Regards,
Jérôme Alves
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160427/c5752363/attachment.html>


More information about the swift-evolution mailing list