SwiftMatters blog saw this article first! Subscribe to my blog to receive my articles as they are published.
In this series, we will be covering how we can code our own declarative protocol-orientated networking layer using our beloved Swift.
Knowing how to communicate with a server and present the response data to a user is a vital skill every iOS developer should have. Over the years Apple has made enhancements to URLSession that make our lives as developers easier which have eradicated the need for third-party dependencies for trivial tasks.
So why would one write their own network layer when…
A bit late into the new year but let’s get to it…
Firstly I would like to wish everyone a Happy and Blessed New year! Don’t take it for granted that we made it into 2019. The purpose of this article is to look back at the year 2018 and share some of the successes and some failures in the year.
Retrospection — the action of looking back on or reviewing past events or situations, especially those in one’s own life.
Now, where should we start? I guess right here on Medium…
I will be starting a series of short posts where I share a small snippet of code. These will be short reads and focus on one main idea.
In the first post of this series, we will look at loading images in our application more efficiently by making use of a cache.
URLCacheclass implements the caching of responses to URL load requests by mapping
CachedURLResponseobjects. It provides a composite in-memory and on-disk cache, and lets you manipulate the sizes of both the in-memory and on-disk portions.
UrlCache gives us the ability to cache responses…
Navigation is one of, if not, the most important aspect of any application. Choosing how users will navigate through the different screens plays a vital role in your applications success.
With the dawn of the AppStore it was very clear what was the most favoured means of navigation. Hamburger menus, Sliding menus, Sidebars whatever you would like to call them. This form of navigation became synonymous with apps. Personally I find many flaws with Sidebars. But since I am not a UX designer, you can read more design-oriented reviews in this article.
Firstly I would like to express my gratitude to everyone who clapped, commented on my previous post Writing a Network Layer in Swift: Protocol-Oriented Approach 😁👏🏾. After some feedback in the comments and more research, I thought it would be beneficial to address the suggested improvements in this post.
We have two simple modifications that can be made to the project that can improve its functionality.
In our previous implementation of URLSession, we made use of URLSession.shared. This code works but it is not optimal. Every time we make a request we instantiate a new session. …
In this guide we’ll look at how to implement a network layer in pure Swift without any third-party libraries. Lets’ jump straight to it! After reading the guide, our code should be:
Below is an example of what we’ll ultimately achieve with our network layer:
Moya is a Swift Network Abstraction Library. It provides us with an abstraction to make network calls without directly communicating with Alamofire. With this tutorial we will learn how to get started with the framework, discover some tips & tricks and learn all basics from code examples.
Let’s firstly discuss why NOT Moya:
Using NSExpression to build a calculator.
The Swift language never seizes to amaze me with all the functionality it provides. I gave myself the task of building a simple calculator as a coding-kata. I had already built a calculator in Java and I remembered the horrendous number of ‘if’ and ‘case’ statement that does all the mathematical logic. So I started out and built my layout as seen in the screen above. I used Snapkit to layout the views. This post won’t cover Snapkit but you can read this as an introduction to Snapkit.
So we are going to perform…
As a self-taught iOS developer who learned most of his skills from watching Youtube tutorials and online courses using storyboards became second nature. For sometime I actually did not even know that there was even an alternative to using storyboards in Xcode. Was I wrong ! As my journey in learning Swift progressed I started seeing a number of projects using programmatic constraints in their projects. So I started researching why one would even want to use an auto-layout DSL. I mean the storyboard works and I did not see any flaws in it (that’s what I thought). …
Welcome to part two of the series. Let us finally get something to appear on our screens. If you are at this stage of the tutorial you should have the following:
Top keep this tutorial short what we won’t be covering in this part is connecting our views to our code. So what will we be covering: