In most parts of Swift, instance methods are treated like properties. However, if you try to reference an instance method using a key path, you get a compiler error. Why is this the case? I assume there is a reason, but I cannot find it. It would be extremely useful in all the same places that other key paths are.
Note that I am not asking about calling instance methods inside a key path. I want to know why this works:
let instance = 100 let method = instance.isMultiple method(10) // true method(11) // false
while this doesn’t:
let instance = 100 let method = instance[keyPath: \.isMultiple] // Key path cannot refer to instance method 'isMultiple(of:)' method(10) method(11)