Faryar Fathi

Composer, Coder, Entrepreneur

All Posts

Dreams

Hold fast to dreams
For if dreams die
Life is a broken-winged bird
That cannot fly.
Hold fast to dreams
For when dreams go
Life is a barren field
Frozen with snow.

Langston Hughes

written poem, quote

A Look at Swift Optionals

In programming, there are times that you need to represent the concept of no value. Take a form field for example where you ask users to enter their age. Assuming that response represents the entered text, you can use the toInt() method of the String class to store the user’s age in a constant:

written coding, ios, swift Read on →

Swift’s Typing Model

Safety is one of the core features of Swift. Apple has incorporated many safe programming patterns into the language to save you from making some common programmer mistakes. A safer type system is one of the ways that Swift helps you write code that’s safer and less error-prone.

Let’s look at a few features…

written coding, ios, swift Read on →

Imma Let You Finish but I Have One of the Best Ideas of All Time!

Sometimes that’s exactly how I feel when I am interrupted by a passionate entrepreneur when I’m trying to explain why ideas are dime a dozen! Ok, now that I got that out of my chest, let’s move on.

We all have idea and often a lot of them. And of course, we tend to think our ideas are generally better, smarter and more valuable than other people’s. But in reality ideas on their own are indeed worthless, or at least, have little value. What matters most is how you execute an idea.

written entrepreneurship, startups Read on →

Invictus

Out of the night that covers me,
Black as the Pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.

In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.

Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds, and shall find, me unafraid.

It matters not how strait the gate,
How charged with punishments the scroll.
I am the master of my fate:
I am the captain of my soul.

William Ernest Henley

written poem, quote

My New App: Enso Meditation Timer

It’s been a while that I’ve been working on a little side project of mine: a meditation timer and bell app called: Ensō.

I have spent quite a bit of of time on Ensō, trying to make it as best as I possibly could. But of course, things are never as perfect as you’d like them to be. So, rather than obsessing over minor details, I decided to release the v1.0 knowing that I could improve a thing or two if I spent more time on it. But hey, there is a v1.0.1 for a reason!

written app, ios Read on →

Sneak Peak!

Here’s a sneak peek of my new song for Piano, Violin and Cello, sans violin and cello!

Hope you like it!

written music, piano Read on →

Organizing Import Directives in Xcode

When writing code, I often end up with quite a few (sometimes repetitive) #import directives on top of my implementation files. Blame it on trying to write good, modular code!

Xcode doesn’t have an Organize Imports feature by default . But I picked up a nice tip in “Working Effectively with Xcode” WWDC video a while ago on how to create an organize imports service with a little bit of help from Automator.

written coding, ios, xcode Read on →

Tip: Hacking Private Class Methods in Objective-C

There is no such thing as a private method in Objective-C. Developers, however, use class extensions to declare the methods they don’t want to expose publicly, effectively making them ‘private’.

Let’s say you are subclassing a library class and to make it work for your application, you need to reimplement one of its private methods without replacing it. In other words, you still want be able to call super, but you also want to add your own code. Something like this:

written coding, ios, objective-c, tip Read on →

Emmanuelle

Emmanuelle started out as an improvisation, like most of my songs. Being a huge fan of Satie’s Gnossiennes, I was trying to play something inspired by them.

What made Emmanuelle special was the ease with which I managed to write it. I usually agonize over every detail of my songs, and more often than not, they end the in a pile of more than 200 unfinished songs that I have yet to decide how to develop, end, orchestrate, etc. But this time, all I had to do was to transcribe the recorded improvisation. Although, I am not 100% satisfied it and wouldn’t mind changing things around here and there, I’ve decided not to change a single note…. at least for now!

Hope you enjoy it!

written music, piano Read on →

Quick Tip: Objective-C Ternary Operator

Use conditional operators (aka ternary operators) to make your code more legible and clear. Conditional assignment is the most common use case for ternary operators.

With the ternary operator, you can turn this:

1
2
3
4
5
6
7
int days;

if (thisYear == leapYear) {
  days = 366;
} else {
  days = 365;
}

into this:

1
int days = (thisYear == leapYear) ? 366 : 365;

Only one line of code, and a lot easier to read and understand when you’re familiar with the syntax.

written coding, ios, objective-c, tip Read on →

What Will Your Verse Be?

O Me! O life!… of the questions of these recurring;
Of the endless trains of the faithless—of cities fill’d with the foolish;
Of myself forever reproaching myself, (for who more foolish than I, and who more faithless?)
Of eyes that vainly crave the light—of the objects mean—of the struggle ever renew’d;
Of the poor results of all—of the plodding and sordid crowds I see around me;
Of the empty and useless years of the rest—with the rest me intertwined;

The question, O me! so sad, recurring—What good amid these, O me, O life?

Answer.

That you are here—that life exists, and identity;

That the powerful play goes on, and you will contribute a verse.

  • Walt Whitman

What will your verse be?

written poem, quote

Objective-C Literals

When I was introduced to Objective-C, its verbose syntax seemed annoying and even unnecessary. But I quickly learned to appreciate the clarity that it often provides and eventually that very same verbosity became one of the reasons that I enjoy writing code in Objective-C. However, there are a few frequently used classes in the Foundation framework that have literal equivalents, and I have opted to use them since they can make my code more concise, easier to read and easier to debug.

Let’s have a look at them, shall we?

written coding, ios, objective-c Read on →

Be Yourself

To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.

Ralph Waldo Emerson

written quote

A Half Forgotten Dream

Dedicating my life to music has been a dream of mine for a very long time. I’ve always believed that music is my true calling and I regret not following my heart and not pursuing music professionally.

I used to console myself and say, “You can do it in the future, when you have more free time.” But life was going on at full speed, and what was once a consuming dream, was fading away with each passing day.

written audio, music Read on →

Hello World!

Testing 1 2 3 …

1
2
3
4
5
6
7
8
9
10
11
12
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {

        NSLog(@"Hello, World!");

    }
    return 0;
}

written