Tap Counter with BDD and UITest in Swift

Github link: here

This project was simple. Just needed to have:

  • a label to display current counter value
  • a button to increment the counter value
  • a reset button to set value to zero

In the spirit of BDD, we will define the test first:

The tests are very simple as well. Straightforward testing the VC buttons and label value.

The new XCode UITest however, has proven to be quite useless as it can’t extract UILabel values. So for now it just tests if the UI elements exists, like such:


New project – 100 Days of Swift

This started when I read this post: 100 Days of Swift by samvlu

I liked that. And since he already laid down the roadmap, I’m just gonna follow it, with a twist.

Instead of recoding everything from group up, which is what I presumed he did, I will try to make use of existing libraries if possible.

BDD will be used thoroughly for practice, which I am quite lacking.

The codes will be as short as possible, while still maintaining readability.

1. Goal – to replicate the app that samvlu did, based on the text and images that he posted on his blog
2. Use open source libraries, BDD and playing code golf

Here comes the github repo:
100 Days of Swift

Why and how to install zsh and fish shell

So if you are developing in unix system, server or even mac OSX, you most likely will have used Bash shell scripting. If you have accessed the Terminal app, then you have used Bash.

What are shells?

Shells are CLIs to access the computer’s operating system without going through GUI. There are many shell systems, wikipedia has a great comparison of them.

Bash is the default login shell for OSX and most unix system.

Windows uses PowerShell.

What is zsh or fish shell?

zsh and fish are two popular variant of shells. Personally I have been using Bash for a while, until I read article about fish shell and oh-my-zsh from HackerNews. I’ve tried them both on, and I would never come back to Bash.

What’s so good about them?

The home page for fish shell has a good list of the feature, but zsh homepage is just sad.
Shortly, zsh is good to extend the functionality of Bash and it has good range of built in plugins. Once you tried oh-my-zsh and used the color schemes and plugins, I really doubt you will be back to Bash.

Fish shell is great for people who wants all the bells and whistle out of the box. It has color schemes, auto-suggestions and completion out of the box. No plugins needed. Fish is a great shell for simple uses.

Ok, what’s bad about them?

Let’s start with fish shell. One of the most glaring thing about it, is the fact that we can’t even use ‘&&’ or ‘\curl’ with it. So if you tried to use rvm install line, it will throw an error.

The same fate will be met after you installed gvm and wanted to use it with fish. This line below won’t work:

So far when I wanted to use gvm, I have had to go back to zsh or bash.

Enough about fish shell, what’s bad about zsh?
Zsh mainly needed to be extended using plugins before it has the functionality of fish. Out of the box, it isn’t that much different from bash. Only ofter installing oh-my-zsh, zsh-autosuggestion and other plugin, will it be more amazing.

How to install zsh or fish shell?

The easiest way of them all, would be to use homebrew. Just put this into bash (terminal) and let it do its thing:

after it is done, you can use the install command to install both fish and zsh

Note that even after installing one or both of these shells, OSX terminal will still opened straight to bash. You would have to change the login shell to make it open to zsh or fish directly.

note: this unix stackexchange answer has a good and brief explanation of what is a login shell

how to make zsh or fish as login shell?

in bash or terminal, simply run these commands

Most likely, bash will complain that fish or zsh is not a standard shell. If that’s the case, just try these lines to add them to the list of shells

That’s all for today. We will discuss about what or how to use those next

Hello, World!

Hello, I guess its about time I started blogging about tech stuff. There will be introduction about who I am in the ‘About’ page that is still unwritten. But for now, lets get to the code journey.

Early 90’s
During my high-school years, HTML was the first programming stuff that I’ve dabbled in. I made simple websites and one discussion forums for online game. Learned from web tutorials.

Early 2000’s
Going to Monash College started me in proper dev stuff. I learned many new things and are very grateful for it.

Middle 2000’s
Then I went on to Monash Uni enrolled in ComSci where I learned C and Unix, too bad I didn’t stick with it for too long and changed course to B of IT & System (BITS). The new course didn’t teach us any new languages, mostly business analyst kinda things.

Late 2000’s
Graduated with BITS, tried to find a job in Analyst field, but couldn’t. So I get back to dev and learned whole lot of frameworks like Joomla, Drupal, WordPress, and PHP for customising CMS.

Early 2010’s
During my professional software engineering career, I learned more than during uni times. We do learn faster on the job. Credit also has to be given to the plethora of online tutorial that arises recently. I learned from books, Codecademy, Treehouse, CodeSchool, BitFountain, etc etc. Even now I’m still learning.

Finally, my fav language so far is Swift.