How to create a generic function in Swift that will reject the given parameter unless it is an Optional?
问题 This question is a follow up to my earlier question: I expected the system to report non protocol conformance, but it does not! Why? Please read the referred question for you to get a better idea of the constraints at hand. I created a generic function in Swift that will reject its parameter unless such a parameter is Optional . The function I created fully works and does what I desire. Meaning, any calls to onlyCallableByAnOptable(...) , even inside an if let , will yield error due to non