24 posts tagged with “swift

How to add Certificate Pinning in iOS (Swift)

February 15, 2019

If you really want to secure your app, you can use a concept called which essentially you store your networking Certificates on the client…

How to get UIColor from Hex String in Swift

February 12, 2019

Many times designers will give colors in hex values and currently does not have an easy way to get the UIColor value of the hex string. A…

How to write code for the only the DEBUG build in Swift

February 09, 2019

One of the common things that you may want to do is run code that is only available in the development configuration. For example; a…

Fixing App Transport Security error in iOS

February 08, 2019

When making a network call, Apple demands that all networking calls are . Now what does that mean? Secure connections means at minimum that…

Adding corners and shadows to UIView in iOS (Swift)

February 06, 2019

In a lot of design philosophies, you may notice that a lot of them like rounded corners as well as adding a dropshow onto the view. In iOS…

How to pass data between UIViewController (Swift)

February 05, 2019

One of the simplest tasks in iOS is being able to pass data between View Controllers. The idea is very simple and easy to implement but not…

Removing elements in an array using Swift 4.0

February 03, 2019

A useful task to perform is to remove a specific element of an array. There are usually two approaches to this, you can determine the index…

How to generate code signing files for iOS

February 02, 2019

In many instances for CI machines you will need to provide Code Signing provisioning profiles as well as code signing certifications…

Change audio output channel in iOS

January 31, 2019

If you application is playing some sort of sound, perhaps music, you want to allow the user to be able to change the output source. Current…

Special literals to get current line number in Swift

January 31, 2019

One interesting feature that Swift has are the idea of special literals. The literals are unique in the way that they are able to obtain…

How to programmatically determine the current iPhone device

January 30, 2019

In many instances as an iOS developer you may want to know which device is currently running the application. In my experience, I would use…

How to add tap function to UIButton

January 29, 2019

One of the most annoyances in iOS development is to programmatically handle a tap action for a . In Android all views have an which…

How to Open a URL in Swift

January 24, 2019

A lot of times your iOS app may need to Deeplink into another app or open up a particular page. Fortunately, there is a function in that…

Programmatically set device volume using MPVolumeView (iOS Swift)

January 22, 2019

Often times in an application you want to be able to allow the user to change the output volume of the app. There is no easy way to achieve…

How to display an Alert Popup in iOS Swift

January 21, 2019

Often times in an iOS application you will need to prompt the user with an alert to either display something or have the user perform an…

Raw Values vs Associated Values in Swift

January 20, 2019

Raw values are used to associate constant (literal) values to enum cases. The value type is part of the enum type, and each enum case must…

WTH is Strong, Weak, Unowned in Swift?

January 19, 2019

A reference is whenever we declare a variable without specifying its reference type, it will always be strong. A reference being strong…

How to run code on the Main Thread with Delay in Swift

January 18, 2019

There are a lot of bugs that could be caused because code in not running on the main thread. Typically this could happen when you are making…

Handling Optionals with 'if let' in Swift

January 18, 2019

Typically when you have an value of let's say type , in order to get the actual value you need to use you must unwrap them. We can…

How to find the Difference between two arrays in Swift

January 14, 2019

In situation where you would like all the elements that are in one array but not the other (ie in one array but not both) - a solution is to…

Easily implement Quick Sort using Swift Filter

January 12, 2019

Quicksort is one of the most famous algorithms in history. It was invented way back in 1959 by Tony Hoare, at a time when recursion was…

Convert JSON to Swift Objects

January 11, 2019

Parsing JSON in swift has always been a nightmare having to deal with Dictionaries and pulling keys from that dictionary. Swift 4+ makes it…

Group arrays by a criterion with Swift 4.0

January 04, 2019

Let's say you have an array, and you wanted to group each item in an array that have a common value. Swift 4.0 has a powerful grouping by…

Simple iOS Network Call using Moya

January 03, 2019

Install Setup Lift off!

Browse all tags