Sharing another simple lesson and insight learnt when chasing a mysterious issue

Image from Unsplash

In the last post, I shared a demonstration and a lesson that you always have to out instance variables in method in your s. (You don’t need to go back to my last post if you landed here first. The bold statement above is the only thing you need to remember, really)

In this post, I will share another interesting case/lesson, which is specific when using Cuckoo.


Let’s start from conclusion this time. Sometimes, to out instance variable is not enough to evade from leaking mock…

Sharing a simple lesson and insight learnt when chasing a mysterious issue

Image is from Unsplash

No stub for method `XXX()`

In my workplace, recently we faced occasional test errors that happened only when run in test suite, even though individual test runs fine.

No stub for method `XXX()` using parameters (). (NSInternalInconsistencyException)

Certainly we have this Cuckoo stub somewhere in our test, but not in the failing test.

This kept me scratching my head for some time, but recently I found out that it is basically happening due to leak of the mock objects (and other objects stems from tests). If you are as naive iOS developer as…

How you can download hundreds of images via script at once + include them in your iOS project

Quite some time, I have been using a very handy tool created by Hardik Vasa called . This tool allows you to download multiple images from Google at once via command line. The following command will download 10 cat images, for example.

% googleimagesdownload -k cat -l 10

That was… until a month ago unfortunately 😢 (It is Mar 1, 2020 at the moment of writing). Apparently, google has changed the format of Google Image search results page and the scraping…

This blog post has been going viral for the past weeks in iOS community. It talks about potential iOS performance optimisations, backed by sound technical argument.

One of the optimisations talks about in . You can read the original blog for detail, but here is the gist :

  • Internally, is just a bitmap. Thus, it is more costly than you would think.
  • It is even more costly when the cannot be rendered in monochrome, e.g., using .
  • It could save you megabytes by nilifying labels’ text when you don’t need them. (Specifically in )


Leveraging CoreGraphics and UIKit techniques for fun and profit

In early December 2019, ShopBack GO released a Scratch Card feature that adds a little bit of fun to our users’ shopping experience. It has been a resounding success, with thousands of users scratching cards every day.

Example of our Scratch Card Voucher

Since this small feature can be easily decoupled and can benefit others, we have open-sourced the functionality. You can check it out below.

In this article, I share my approach to implement the scratch card interface for iOS. I believe the tricks I learnt can be applied to other types of interfaces too.


Two blazingly simple ways to organize your complex collection of data


In the first part of this tutorial-style article, we completed the first section of the demo app, using . In this second part of the article, we will finish the demo, and also demonstrate how to create the equivalent in SwiftUI.

If you remember, there are three different classes/concepts:

  • NSCollectionLayoutItem
  • NSCollectionLayoutGroup
  • NSCollectionLayoutSection

represents the size of each , and represents the same for the section. is something in between to allow creating a flexible layout in each section.

Let’s look at the second section now!

Cat Foods Section


Two blazingly simple ways to organize your complex collection of data

If you have used our GO section of our ShopBack app, you probably might have noticed that our home screen is vertically scrollable as a whole, yet some rows on the top are horizontally scrollable.

ShopBack GO home screen

To implement this type of interface that mixes vertical scrolling and horizontal scrolling, before iOS 13, it meant you need to implement nested , by setting inner instance(s) in outer 's cell(s). …

Safely store sensitive information in the repository to share them with your colleagues and also CI/CD

When you make an app that consume any resource over network, it will most likely hold sensitive information, like API key or API secret.

For example, TMDb API is a handy API with which you can query movie information with number of different filters. You can create an app that shows list of movies like below in a jiffy. Yeah, it’s really handy.


As a frontend developer, you take pride in implementing whatever cool design your designer brought to you. For that, you want to prepare your mindset by making it a habit to look at cool designs and think about how to implement it.

I have recently encountered a cool design in Instagram :

Design by Adam Zielonko (

There are quite a few cool factors like speed animation of progress bar, or map-button-transforming-into-three-buttons etc. However, in this article, I want to focus on the animation of the line path, which is at first used for progress bar, but later transformed as a path on the map.

Achieving a unified custom look throughout the app with simple tricks

What we want to do

In iOS, there is a mechanism called to define an app’s global configuration. For example, you can set a consistent background color of the navigation bar with just one line :

UINavigationBar.appearance().barTntColor =

However, if you apply the same approach to the font like this:

UILabel.appearance().font = UIFont(named: "Gills Sans", size: 14)

all the instances will indeed have “Gills Sans”, but with 14pt size as well. I don’t think any app would want to have only 14pt fonts throughout the app. …

Yuichi Fujiki

Coding in Swift, want to learn Flutter, a Dad, a Rock Climber, learning Parkour and Guitar

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store