Photo by Alina Grubnyak on Unsplash

What is Protocol-Oriented Programming?

Protocol-Oriented Programming is a new programming paradigm which is used by Swift. In the Protocol-Oriented approach, we start designing our system by defining protocols then the protocol extensions, protocol inheritance, and protocol compositions which allow us to add a new functionality not only to one type, but to a whole collection of types that all conform to the same protocol.

The value types in Swift like struct or enum cannot inherit from other structs or enums which means we cannot use inheritance with value types, but the value types can inherit from protocols, even multiple protocols which is the most…

Photo by Markus Spiske on Unsplash

AVFoundation is a multimedia framework with APIs in Objective-C and Swift which provides high-level services for working with time-based audiovisual media and combines six major technology areas which will go through each one in more details up and running, so let’s start with the first area in this article:

Play an audio with AVAudioPlayer

  • Create the songURL for the audio which wanna play.
  • Create the player and hold the reference of…

Photo by C D-X on Unsplash

Before starting playing, streaming, recording sounds or configure how your application and the operating system should respond to the interruptions, we need to take a small journey to the Core Audio and some definitions about the audio just to get the full picture. In the next parts will talk in more details up and running.

What’s Core Audio?

Core Audio is the digital audio infrastructure of iOS and OS X. It includes a set of software frameworks designed to handle the audio needs in your applications which is optimized for the computing resources available in a battery powered mobile platform.

Core Audio uses…

Photo by Jan Antonin Kolar on Unsplash

Will talk about how we can use Apple Combine with Core Data but if you like to read more about Core Data itself and how can we use it to save, fetch and delete the entities you can read the previous article about Core Data with Sugar Syntax.

First we will need to create a custom Combine Publisher and fortunately it’s super easy to do that we will need just 3 steps to do it but before doing that we need to understand how the publisher actually work, so let’s talk about that for a bit before applying our customer…

Photo by Jan Antonin Kolar on Unsplash

When I started iOS programming since years ago I was mixing up between the Core Data and the Database, but in fact the Core Data is not a database even Core Data is actually backed by an SQLite database but both of them are ways of providing searchable and persistent storage. In short description we can say that SQLite is a database itself and Core Data is an ORM (Object Relational Model) which creates a layer between the database and the UI.

What’s Core Data?

Core Data is a framework that you use to manage the model layer objects in your application. It…

Photo by Max Duzij on Unsplash

In Part 1 talked about what’s Combine and how we can understand and use it and in Part 2 talked about more examples of the usage.

Now let’s leverage what we have learned and apply into real examples.

1- Listen to UITextField when text did change

2- Check if the device orientation is portrait

3- Execute network request when user types any text on UITextField

4- Performing Key-Value Observing to listen to a property’s value change

  • The User class should beNSObject and the property should be@objc dynamic.

5- Create a Timer

6- Credentials validation to enable login button

7- Ask the user for the notification permission

  • You can read more about Future and Catch
  • Its always good to breakdown the code into small…

Photo by Max Duzij on Unsplash

In Part 1 talked about what’s Combine and how we can understand and use it and in this part will go continuing the examples of the usage.

16- Comparison

  • When we need to republish items from another publisher only if each new item is in increasing order from the previously-published item.
a is: 1 b is: 4
a is: 2 b is: 4
a is: 0 b is: 4
a is: 3 b is: 4
Value is: 4

17- Concatenate

  • When we need to emit all of one publisher’s elements before those from another publisher.
Value is: A1 Value is: A2 Value…

Photo by Max Duzij on Unsplash

What’s the Combine?

The Combine framework provides a declarative Swift API for processing values over time. These values can represent many kinds of asynchronous events. so in an imperative programming setting a = b+c would mean that a is being assigned the result of b+c, and later, the values of b and c can be changed with no effect on the value of a, but in reactive programming, the value of a is automatically updated whenever the values of b or c change, without the program having to re-execute the statement a:=b+c to determine the presently assigned value of a . Wikipedia


Photo by Kevin Ku on Unsplash

Have you ever pushed a commit on your branch and your commit did fail and then you fixed your commit and pushed again?

The solution to get rid of that is so easy and thanks for Git Hooks which offers pre-commit for us which’s used to inspect the snapshot that’s about to be committed to see if you’ve forgotten something, to make sure tests run or to examine whatever you need to inspect in the code.

What’s under the hood:

If you went deep in .git folder you will find a lot of samples for the hooks. …

Photo by Markus Winkler on Unsplash

In Part 1 talked about how to integrate your project on Github with Bitrise to save time for building your project.

In this part will talk about how to integrate your project with fastlane to save time for sending TestFlights and releasing via Bitrise.

1- Integrate your Xcode project with fastlane.

In these steps we will walk through integrating fastlane with Xcode project on your machine:

1- Installing fastlane.
Install the latest Xcode command line tools:

xcode-select --install

Then install fastlane using:

# Using RubyGems
sudo gem install fastlane -NV
# Alternatively using Homebrew
brew install fastlane

2- Setting up fastlane. Navigate your terminal to your project’s…

Bassem Qoulta

Senior iOS Developer, Berlin, Germany

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