It’s simply a property wrapper used by SwiftUI to managed its view’s appearance or “state”.

Property Wrappers?

You can think of property wrappers as additional behaviours and functionalities added to a property to do more. You can think of them as weak or @IBOutlet but more powerful.

Property wrappers play a huge role when it comes to managing your views in SwiftUI and are tightly integrated. We are going to be focusing on one of them called @State.

What is it?

It looks something like this:

@State private var iLovePizza: Bool = true

This property is used inside a view and you can use it…


In this article i hope to explain why we may use the @escaping attribute and explain the difference between the default @noescape.

If you used Swift 2 you may have used the @noescape attribute and you may know that this was later deprecated in Swift 3 with the introduction of the @escaping attribute. In order to understand why, let’s look at what we mean by @escaping.

Escaping Closures

A closure is said to be escaping when a closure passed in as an argument and executed after the scope of a function or when a function is returned. …


ARC, also know as Automatic Reference Counting, used to manage your app’s memory by keeping counts of all the allocated class instances and freeing up any allocated memory when those instances are no longer needed. Before we dive into ARC lets quickly discuss value types and reference types a they are an integral part to memory management.

Value Types

If you worked with Swift you should be able to distinguish value types with reference type. Struct and Enums are value types. Let’s see and example.

var myAge = 20
var yourAge = myAge
myAge = 30if myAge == yourAge { print("Both…


Hi everyone, its been a little while since i blogged here but better late than never.

Hope everyone started to settle in with the mammoths of new and exciting changes from WWDC 2019. I for one started to experiment with Swift UI and Combine frameworks and must say they are pretty amazing to work with even tho it runs on magic and pixie dust 😅.

In this blog i want to show you how to perform a network request and parse the response using the new Combine framework.

The basics.

Publishers: “Declares that a type can transmit a sequence of values over…


How does one use resources such as Images, Xibs and Storyboards in static libs. By default this is easy to achieve in dynamic libs however when it comes to static libs things can get a bit challenging. In this article i hope to explain how you can uses resources such as a Storyboard and Images in Static libs.

Lets jump in.

Step 1: Creating the static library

Navigate to File -> New -> Project and select Cocoa Touch Static Library.


If you used Xcode then its certain that you come across and used templates for your projects. These can be file or project type templates such a Cocoa Touch Class, Storyboard, Core Data, Dynamic or Static Libraries. These are default templates which are bundled up with Xcode and for most of our use cases these should be sufficient, however if you are having to duplicate a certain functionality many times then things can get repetitive and inefficient. Lets say you have a policy of running a certain build script (SwiftLint for example) for all your project frameworks, you then have…


In this article I hope to explain how one can use the new CaseIterable Protocol to enumerate through all cases in your enum and explain some of its limitations.

What is CaseIterable?

It’s a protocol, introduced in Swift 4.2. It automatically synthesises a collection of all the cases in your enum in the order that is defined, however you have to provide your own allCases implementation if your enum contains associated values (more on that later).

Example

Lets look at a delicious example 🍕🤤

enum Pizza: CaseIterable {
case neapolitan
case chicago
case newYork
case sicilian
case greek
case california
}
let pizzaTypes =…


If you worked on an iOS app you may have come across asynchronous tasks such as API requests, image process, data download etc. If so then you know it can be a painful process especially when your need to chain these async tasks in series. In this article i hope to explain how one can make this process simpler.

I have been doing some JSON parsing for an iOS app I am working on. The setup required multiple API requests and some data processing and parsing before results can be populated and presented appropriately to users. Even though with the…


Apple introduced Core ML back in June during the WWDC 2017 conference as a means to integrate machine learning into applications we love and use. In this article I hope to shed some light on what Core ML is and how to use it.

What is Machine Learning?

We are surrounded by lots of data we can use to derive meaning and classification. Machine Learning is the process of deriving meaning from data, it provides machines the ability to distinguish, classify and recognise entities or patterns without having to explicitly be programmed to do so.

Let’s look at an example…


What is protocol composition?

It is the process of combining multiple protocol into a single protocol. You can think of it as multiple inheritance except with protocols.

Let’s look at some examples.

The below implementation represents a dog which can bark and wag it’s tail when calling ballFound().

protocol CanDoDogThings {

func bark()

func waggTail()

}
struct Runner {

let dog: CanDoDogThings

func ballFound() {
dog.waggTail()
dog.bark()
}

}

This is a simple and convenient implementation as it clearly defines what the dog is capable of doing when ball is found, wag it’s tail and bark. This approach can also…

Melvin John

A Software Engineer with a passion for technology. Working as an iOS Developer @BBC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store