I started developing for the Mac back in 2006, when the iPhone did not exist yet. Me and a friend had an idea for a diet app we wanted to build (which was a failure in the end, but that is a story for another time). I knew programming from university, but software development was a new thing for me. While I knew how to write little programs, a complete app was a different story.
A couple of years ago a company hired me for a last moment rescue of an app they were developing for a client of theirs. After months of development the app was late and full of bugs. The goal was fix as many bugs as possible in one week, before we delivered the app to the final client. This was not the first time I had to rescue a project and probably will not be the last. Any freelancer can tell you that, as deadlines get closer, companies sometimes bring in extra power to be able to meet them. As I poked around the code it became clearer and clearer what the source of the problem was.
Browsing Q&A websites I often find people having problems when learning iOS development through tutorials:
“I just don’t know how to make my own code. I can go through these tutorials and write their code and understand, I just don’t know how to implement it all by myself.”
This is understandable. Authors suppose their tutorial will introduce you to a topic, but all they do is to show you something without giving you the understanding of what you are doing. In the end you are only copying someone else’s code.
Since the introduction of Swift, optionals seem to have caused a lot of confusion for people learning the language. I have to admit that at the beginning it took me a while too to wrap my mind around them. The cause was that I didn’t take the required time to fully understand them. Continue reading
Recently one of my email subscribers wrote me this:
What I find is that I’m learning the various steps but I do not understand the “big picture”. For me, a guideline, would be helpful. I know Swift is available but I do not even know object oriented programming. I’d really like to see a “roadmap” that says: if you know or do not know this, start here and learn this, then this, etc.
iOS apps are built according to a widespread programming pattern: the model-view-controller pattern (or MVC). The MVC is a high-level pattern used to describe the global architecture of an application and to classify objects according to the general roles they play. In MVC objects tend to be more reusable and programs are more easy to change.
I read online some remarks of people claiming that the introduction of the new Swift programming language is going to remove all the barriers to entry for iOS development. Some even think that Swift is going to put every developer back at square one. I understand the excitement around a new language after 20 years of Objective-C. Although these claims might have some merits in the long term, they are at the moment not only inaccurate but completely opposite of reality.
We developers often make the mistake to dive into coding too soon, because this is what comes natural to us. What we usually fail to realize is that coding is expensive. I made this mistake myself often in the past. When we code an app from scratch, where the main design decisions still need to be made, we soon find that many parts of the app need to be often rewritten during development. The reason is that, while coding, we will find that things do not quite work as we planned in our mind and there are cases we did not consider at all. All these would have been obvious if we approached the process in a different way.
After seeing how classes and objects work in Objective-C, this part will be completely dedicated to types in Objective-C. This feature comes straight from C, but it’s still extensively used in Objective-C programming, including Apple libraries. Since you will encounter this quite often, it’s worth to spend some time having a look at this feature.
Table of contents
Defining custom types
Constants and enumerations
Bitwise operators and bitmasks