This Week in Mobile: Improving Completion Blocks and Avoiding RxJava Leaks
Among the many topics in this week's edition, we discuss how to improve completion blocks in Swift, and how to avoid memory leaks when using RxJava subscriptions.
Join the DZone community and get the full member experience.Join For Free
There's no doubt that you use completion blocks in your code, but to someone using your API they can be a little opaque. Alex Curran puts forward a simple but effective way of making your completion blocks simpler.
Although not without its limits, the Speech Recognition API introduced in iOS 10 can be a powerful addition to your app. This tutorial will get you up to speed with what is possible.
Wendy Lu's talk on Data Consistency in an Unpredictable World explains what an immutable model layer really is, and how the team at Pinterest used the concept for their app.
Using CocoaPods internally is an excellent way of maintaining a clear separation of concerns. Creating a pod is not nearly as complicated as you might expect. Here's how to Build an iOS, watchOS and tvOS framework with a dependency using CocoaPods.
Bookmark this one: here are all the keywords in Swift described in one single post.
Some projects to check out:
FSPagerView: FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
WCLShineButton: This is a UI lib for iOS. Effects like shining.
SwipeCellKit: Swipeable UITableViewCell based on the stock Mail.app, implemented in Swift.
RxJava is one of the most popular libraries around, but it can be easy to make mistakes. For example, here's how to leak memory with Subscriptions in RxJava.
Having said that, RxJava can give you a lot of benefits. In Moving away from the Event Bus with RxJava and Dagger 2 you'll see how it can clean up your code, and give a more elegant solution.
Want to get in on the functional programming fun? This article introduces some concepts and techniques from the functional world into Android programming.
Sometimes it feels that offline first is just another buzz-phrase. In this post, you'll see how Trello's mobile apps now work offline. It's not as complicated as you might expect, and your users will thank you for the effort.
Some projects to check out:
Alerter: An Android Alerting Library
mkloader: Beautiful and smooth custom loading views
sensey: Detecting gestures in a snap
Your users expect animations from your app, not just because it looks nice, but because it actually has meaning. Here are three key uses for animation in mobile UI design.
Looking for some new reading material? Check out this list of the Top Tech Books of 2016.
Feeling stuck in a rut with your career? Here's some advice on how to survive a career pivot and give yourself a professional reboot.
Design Patterns can sometimes sound a little more complicated than they should. Read Design Patterns for Humans to get much clearer explanations.
Opinions expressed by DZone contributors are their own.