Tag Archives: events

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

Raising custom events

How do you define and raise custom events in C#? public event EventHandler<TEventArgs> MyEvent; protected virtual OnMyEvent(TEventArgs e) { if (MyEvent != null) MyEvent(this, e); } This is fine, but now in a multi-threading environment, where things get nasty: suppose … Continue reading

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