SwiftLocation 4.0.0 is here

Maintaining opensource projects, even if smaller is an hard work and require commitment and focus.
Pushing them forward, fixing unavoidable bugs, reviewing issues, answer to questions is somewhat another job.

During the past years I had worked to several libraries; most of them were born from a personal requirement both for side project or at my full-time job. With this gym I learned tons of new stuff about programming, algorithms, best techniques & pattern… behind every line of code there was an entire world made of time and dedication to make my seniority always fresh and updated.
But before everything else it’s just a passion.

View the article

Throttling calls in Swift

Throttling wraps a block of code with throttling logic, guaranteeing that an action will never be called more than once each specified interval.

Throttle is typically used inside search boxes in order to limit the number of backend requests while user is typing for a query; without throttling when an user types fast, backend server may receive tons of non useful request which are quite costly.
Moreover client will be busy updating continuously the UI with no longer relevant results: the entire behaviour causes your app to look cheap and the logic unnecessary complex.

Usually when implementing this kind of feature the first options you may consider is to use an NSTimer  fired/invalidated at your set interval. Repeating this boilerplate code in your view controller its not a good idea; usually you want to avoid any mess logic tracking state in a portion of your code that you’ve been trying to keep stateless.
Another solution involves RxSwift which has a throttle implementation out of the box; btw including an entire lib and use just a function its not a good practice after all.

View the article




View the article