Typescript: declaration vs assertion If you "need" to use as any always know it's a code smell. What's more, I think the keyword as has been used too many times in a code I've seen. I think this is because Typescript developers I have worked with
Callbacks and useEffect In the previous article, we talked about using objects in useEffect's deps. Now it's the time to talk about callbacks. In a PR I've revied once I've seen the author implement a component that was responsible for selecting a consultant. It'
Objects as useEffect deps Some time ago my company decided to switch from native to React Native. For the last 2 years, I have gathered enough experience (I hope) to be able to say a word or two about React. The first thing I want to cover is a common mistake developers make, even
The learning materials list for RxSwift Reactive programming is awesome and really makes complex I/O stuff simple. However, FRP is totally different approach how you look at the events and programming. Such a change in thinking requires good quality materials which can make the learning process simpler and quicker. Here’s the list of materials
Memory management in RxSwift - DisposeBag I’ve noticed a lot of beginners in RxSwift ask about DisposeBag. DisposeBag isn’t a standard thing in iOS development neither in other Rx’s implementations. Basically, it is how RxSwift handles memory management on iOS platform. In this article, I want to answer for few question like what
Top mistakes in RxSwift you want to avoid When we learn a new programming language or new frameworks we always do some mistakes. This is how we people learn things. In this article, I’m want to show you my top 7 mistakes which I did during my Rx trials. I hope I will help you to avoid
RxCaseStudy: Default value after a countdown Recently somebody asked me how he can send a default value if the stream hasn’t sent a new value in 5 minutes using RxSwift. The final solution is short, however it uses few operators like merge, concat & flatMapLatest together which makes it more … advanced usage of Rx. I
Combining Observables: combineLatest, withLatestFrom & zip When it comes to writing an application in the reactive way, sooner or later your output will depend on more than just one Observable sequence. ReactiveX offers multiple operators to combine multiple Observables into one sequence. Today I’ll describe what are the differences between combineLatest, withLatestFrom, zip and what
Creating an Observable: create, just, deferred RxSwiftCommunity is great and has already developed great Rx wrappers for existing API in iOS/mac world. However, you will always find a library or framework which doesn’t have Rx extension yet. ReactiveX offers you 3 operators which you can use to wrap not-reactive code within an Observable. These
RxSwift: Reactive Programming with Swift - The book review The last Friday evening and the whole weekend I spent with the first book about RxSwift. It took a couple of months to prepare the book for four authors however, it took me 2 days to read it 😅. What I’ve found in this book? Who will take the most
How to handle errors in RxSwift In recent days MVVM become very popular architecture design for iOS apps. Especially when RxSwift starts to gain more and more popularity. In RxMVVM most of properties are expressed by Observables. However, Observables terminate whenever they receive error or completed events. Termination means an Observable subscription won’t receive any
RxTest - How to test the Observable in Swift Few articles earlier I showed you how you can wrap presentation of UIAlertController with the Observable. Despite there weren’t any tests in the sample project, I’ve written the whole sample in TDD. I didn’t upload test files for the last time because I didn’t want to
Presenting the UIAlertController with RxSwift Showing an action sheet seems not to be a typical use case for the Observable. My first implementation ended with multiple PublishSubject inside UIViewController and ViewModel. Multiple subscriptions inside Observable’s chain is usually a code smell. Of course, I didn’t have multiple subscribe method calls inside my code,
Write snapshot tests! Today’s topic is not connected with RxSwift at all. Recently, I’ve started using an awesome library so I decided to write an article about it, because it’s worth to mention. Don’t worry, I will come back with reactive stuff soon 😉 I hope you know how important
Thinking in RxSwift It has been a long time since my last post. I wanted to prepare an article which will cover the theory which stands behind Observable and show the usage on real, not dummy example. It has turned out it was not trivial task as I thought 😉 The article is split
RxSwift - Start using it today! The practical introduction My journey with FRP has started with ReactiveCocoa v2.4 which was the most popular library implementing concepts of Functional Reactive Programming in Objective-C. At the beginning, I had a shallow understanding of ReactiveCocoa so I limited the usage only for listening for UI events (like button taps) or handling
The Single Responsibility Principle in Swift Sometimes I have a feeling that not everybody cares about where to put a piece of code which we’re writing. Sometimes, the “does it work?” question is sufficient requirement to mark a task as done. Especially, when it comes to adding new code into existing project. Recently, we had
Rules for better Swift code For nearly last 6 months I’ve been writing code only in Swift. I can say it was a “love at first use”. Now I cannot imagine that I can start a new project with Objective-C. During these 6 months, I’ve read a lot of stuff about good practices
Keep your hats on! - Typhoon - The Dependency Injection Framework What is the Dependency Injection (DI)? When I heard about DI for the first time it sounded very difficult to understand. Luckily, I was wrong ;). Dependency injection is a simple principle. To summarize it in on sentence „The object should rely on it’s dependencies, but it shouldn’t instantiate
I can be whatever you want - Mocks and stubs Probably when you read some articles about unit tests you can find a sentence like „Keep the unit small” or „For such reason there is a unit word before in „unit test” phrase ” But… what does it mean? My UIViewController has 1000 lines of code! Is it possible to create
Choose your unit test tool! - Specta What I love in my job is a community of people with common interests. Our society really likes to share with knowledge which we have learned. That is awesome! Thanks to it we can constantly increase a quality of our code and don’t repeat unnecessary mistakes. That brings us
Are unit tests worth an effort on iOS? Nowadays I have such feeling that iOS developers, and in general speaking mobile programmers, don’t write unit tests of any kind. When I asked few of them „why?” they answered: * „Because it is time-consuming” * „I don’t know where to start” * „Mobile apps are so small there is nothing