Tag Archives: delegate

Swift events: almost generic, almost solution(s)

I have been thinking about a possible better/generic solution for adding multi-cast delegate/event dispatching support to Swift class hierarchies since January, i.e. since more than 6 months ago. While in my opinion the solution below is still not better than … Continue reading

Posted in Swift | Tagged , , , , | Leave a comment

Swift events

Swift does not have built-in .NET-like events. (I admit, I was used to have them in C#, although implementing the weak pattern in .NET was not the easiest job either.) Instead, in Swift there are two common patterns that developers (and even Apple) … Continue reading

Posted in Swift | Tagged , , , , , | 4 Comments

Expression vs. delegates

Using LINQ lambda expressions is fun. But did you know that lambdas can be viewed either as delegates or as expression trees? Specifically, both lines from the following snippet compile successfully: Func<double, string> f = v => v.ToString(); Expression<Func<double, string>> fe = v … Continue reading

Posted in .NET, C# | Tagged , , , , | Leave a comment