DEV Community

Discussion on: Explain iOS development like I'm five

Collapse
 
xhan profile image
John Doe

Where do I put reusable functions?
I think that depends on where or how you plan to reuse them. If a function is shared by related classes, perhaps you can place it somewhere along the class heirarchy where they can be inherited by subclasses. If a function is shared by classes that are not exactly from the same hierarchy, you can look into using extensions.

Another option would be to create a Helper/Utility class that can be used anywhere, although some people say that having utility classes can violate the purpose of object-oriented design.

What is AppDelegate's role?
I like to think of it as the middle man between your app and the operating system. iOS calls the AppDelegate to inform your app about its lifecycle events so your app can handle them accordingly. Examples of these events are: when the app is about to go to the background, when it's about to be terminated, and when it's opened from a URL. Delegates are a huge and important part of iOS development.

Where would I put my models?
The link posted by Casey Brooks is similar to how projects I have worked on are usually organized. I think it's a good jump off point. :)

Is it more of a "one right way" or a "many right ways" kind of culture?
I'm no expert, but I think there's always several ways of building something. Your design should depend on what works for your situation. Although there are prevalent best practices and design patterns, at the end of the day it's still best to tailor-fit all these to your specific needs.

What do web developers typically least understand about iOS development?
I dabble on some web development from time to time, and if I am to put myself in the shoes of a web dev with no prior experience in iOS development, I think it would take a while for me to wrap my head around how building for iOS (or mobile development in general) takes you a bit closer to the hardware. You have to optimise for smaller screens, smaller memory, and sometimes you have to communicate with lower-level elements. The OS can also meddle with your app's life cycle. For example, if your app takes too long to wrap things up while performing background processes, iOS will terminate it.

Again, I'm no expert myself. But I hope these somehow shed more light into the world of iOS development :D