Ever heard about The Tower of Hanoi? It’s a famous puzzle when you have a stack of disks with different sizes and 3 rods that you are required to move all disks from one starting rod into another. Although this problem is difficult for most people when they first know about it, it can be easily solved by using recursion.

Recursion is a widely used technique in programming. It’s one of the choices to be used to solve the divide-and-conquer problems. By definition, recursion is the method of solving a problem by dividing it into smaller pieces. …

In this section, currying and partial function will be the main topic to discuss.

Not only in programming, but currying is also a common term in mathematics. It is the process to transform a function that accepts multiple parameters to a sequence of multiple functions that each of them accepts a single argument.

Take an easy example. We have a function that returns the sum of 2 numbers:

f(x, y) = x + y

We can define a function h such that

h = x + y = f(x, y)

hx(y) = x + y = hy(x)

Explain: the function…

You might heard about this before — Function Programming. Wait, aren’t we using function everyday? What is the difference?

Look at this example

This is a simple piece of code. What it does is to filter out the even number in a given array, sort them in ascending order and print out to console. How much time do you need to read and understand the code? Let me guess, at least 30s.

What about this

In less than 5s, you should now the purpose of this code. It returns the same result but less code and more readable…

Reactive programming has became popular as a useful programming paradigm for all developers in the world. It provides many concepts and tools for us to make our life easier.

To talk about Single, as describe in ReactiveX website:

A Single is something like an Observable, but instead of emitting a series of values — anywhere from none at all to an infinite number — it always either emits one value or an error notification.

Single is really useful when you want to subscribe to something once, and it only has 2 states: either success or failure. …

Protobuf, or called by its original name Protocol Buffers, is Google (not newly) invention that is created to resolve the weakness of XML. It is a method for serialization and deserialization structured data. To have a better sense of what Protobuf is, let’s take a look at this example.

You have been assigned a task from your team lead to implement a function to create and retrieve a list of order. This is the steps that often taken to implement:

  1. Cross team discussion about the requirement and dependencies
  2. Create a prototype for data structure to communicate between frontend and backend

Swift is a very powerful programming language and it makes developer’s life much easier since its birth. In this topic I’m gonna show 4 different ways to check if a value is in a range.

Suppose we have a value = 10, and we want to check if it is in range from 4 to 20.

  • Pattern matching operator ~=
  • .contains method
  • if case
  • switch case

SSL stands for Secure Socket Layer, which is a protocol for creating an encrypted connection between client and server. It ensures that all data pass in network will be private and integral.

How SSL works? When client establishes the connection with server (called SSL handshake):

  1. Client connects to server and requests server identify itself.
  2. Server sends certificate to client (include public key)
  3. Client checks if that certificate is valid. If it is, client creates a symmetric key (session key), encrypts with public key, then sends back to server
  4. Server receives encrypted symmetric key, decrypts by its private key, then sends…

Any of us must have a chance to work with sequence in Swift. And we must also experienced with tasks such as calculate sum of an array, or find odd items in the list. Me also. Before I knew about these higher order functions, I always have to write code to iterate through the entire array. But since I learned how to use this, I felt myself in the past was so stupid (now still stupid, but less).

Let’s start. First, what is higher order function? Here’s the definition from Wikipedia:

In mathematics and computer science, a higher-order function (also…

Today, Apple officially launched the new version of iOS — iOS 11. Along with that, they also release the new Xcode 9 yesterday. One of the great feature in this new IDE is wireless debugging. In this article I will show how to use this awesome feature.

Let’s me give a list of annoying things when living with wires and cables:

  1. As we all know, a laptop usually have 1–2 ports. But we have a ton of things to connect such as keyboard, mouse, screen, smartphone,… Too many devices but too few connect ports. How to solve this problem? …

This is the part that will show how to integrate GraphQL to your iOS application. We will use Apollo, a framework that allows you to query, mutate GraphQL server and returns results as Swift types.

  1. Install apollo-codegen:

First, we need to install apollo-codegen, a tool to generate code and annotations from GraphQL schema and query documents. Now we open Terminal and type this: npm install -g apollo-codegen

2. Install Apollo framework

Create your Xcode project. I’ve already created a project called GraphQLExample. To add Apollo to this project, I used Cocoapods. Add this line to pod file

pod 'Apollo'


Andy Nguyen

I’m a full-time dreamer, and also a developer. My Git: https://github.com/dzungnguyen1993

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