I believe that we, as working developers, need to be very careful about what frameworks we add to our projects. The list of questions we should ask ourselves before adding a framework to our projects is at least a mile long (depending on your font size of choice). However, there are some frameworks that are so fundamental that doing anything without them would be very difficult and cumbersome. In this article, we take a look at four frameworks that all iOS Developers will need to get a grasp on very early on in their careers.
The Foundation Framework provides some base functionalities that iOS developers almost seem to take for granted these days. These functionalities include:
- Data Storage and Persistance — The
FileManagerclass is an excellent example of how Foundation makes the file system available for developers to store and persist data that can make our programs useful.
- Text Processing — Foundation also includes classes like
NSRegularExpression, that help us parse and process text in very efficient ways.
- Date and Time — The
Calendarstructs provide ways to easily mark and work with specific places in time, and to make calculations and comparisons with dates that take time zones and calendar systems into account.
- Networking — Foundation provides a whole myriad of classes within the URL Loading System that help developers communicate over a network using standard protocols such as HTTP. I’m sure that most of us have already run into the
URLSessionclass, and have seen how handy it can be.
- Processes and Threads — Last on this list, but absolutely not least, is the ability to interact with the operating system and with other processes. Foundation provides a series of classes like
NSLock, that help us speed up execution of our programs, and to protect data integrity and eliminate race conditions while doing so.
The Dispatch Framework, perhaps better known as Grand Central Dispatch, provides a whole bunch of easy-to-use classes and structs that makes life easier for developers working in multicore environments. It accomplishes this by giving us access to:
- Dispatch Queues — The
DispatchQueueclass takes on the management of work items. We place a work item in the queue, which then proceeds to execute it, either concurrently or in serial depending on our specifications.
- Dispatch Groups — The
DispatchGroupclass allows us to monitor a set of concurrent tasks together and wait for them to finish before we allow our program to move into the next section of code. This is particularly useful if we want to execute a whole bunch of independent code in parallel, but we need all those concurrent tasks to finish before executing the next part of our program.
- Dispatch Semaphores — Synchronization of critical sections (that is, sections of our code that multiple threads are not allowed to access simultaneously) has been a topic of research since multi-threaded programming was thought of. The
DispatchSemaphoreclass is one of many solutions to problems that are associated with critical sections, since it allows the kernel to pause one thread if a section of code is already occupied by another thread.
StoreKit is a framework that most developers should be interested in. If we work hard to create an app that people benefit from, we definitely want to give ourselves the opportunity to keep maintaining and developing it. StoreKit provides a way for us to get paid by selling subscriptions, or by letting our users make one-time in-app purchases. StoreKit also provides us with access to the Apple Music Library, and with methods to ask for ratings and reviews that will be visible on the App Store.
Combine is a new framework, fresh out of Apple headquarters, that really lets developers take advantage of all that event-driven programming has to offer. By using two protocols,
Subscriber, Combine allows developers to asynchronously handle user interface events, to handle network responses, and to transform data and update data models. Antoine van der lee 🇳🇱 published a very good article, with an accompanying playground repo, that allows you to get started with Combine and explore what it can do for your applications.
That’s it for this time! Feel free to comment if you have questions, and follow to get notifications about future articles.
To learn more about Software Development, check out my previous articles:
How To Stay Sane As A Remote Developer
The 5 most important lessons I learned from my first year of being a remote developer.