Page 1 of 1

posting NSNotificationCenter events

Posted: 16 May 2014, 16:58
by mmilen
Hi,

Would be possible sometimes down the road to add NSNotificationCenter events in addition to the delegate events. I'm working on a project that require pretty loose integration with SFS. I have added code to forward all delegate events to NSNotificationCenter it would be nice if we can hook up to those directly.

Re: posting NSNotificationCenter events

Posted: 16 May 2014, 19:12
by Lapo
This would possibly involve duplicating the event dispatching system which may add confusion to the API. In general we have tried to follow two rules:

1- make the API consistent across languages
2- use specific features of the language that developers are familiar with

It's a bit tricky to balance the two aspects because they may conflict, but it helps when switching from platform to another and when learning from examples done in languages other than the favorite one(s). In other words you can study a game example in C# and still be able to easily transport the code to Obj-C or C++ (or any other) thanks to a consistent mode of programming.

With this said I would probably suggest to build a simple layer of abstraction between your code and the API so that they remain loosely coupled.

Re: posting NSNotificationCenter events

Posted: 16 May 2014, 20:50
by mmilen
Thanks, make sense. This is what I have done , abstracted he delegate.