Swift

Showing 1 to 4 of 25 posts.

How to open and parse JSON file/data in Swift 5.1

Posted on December 1st, 2019 in Swift by George

A short example of how to open a JSON file from the root folder of the project.

This example will use a fictional file named Addresses, "addressesAPI" of type txt.

 

Read more...

Swift 5 / 5.1 Enumeration with enum and enum method example

Posted on November 23rd, 2019 in Swift by George

 

In this example, I will create an enumeration using "enum" and a method "compareVales".

The compare value method will return a text string to show which value has primacy based on a predefined Rank.

Read more...

Defer Swift 5.1 / 5 with example

Posted on November 23rd, 2019 in Swift by George

 

Defer is used to executed code only after the rest of the function body has been executed but can be declared anywhere inside of the body of the function.

Below you can see an explicit example.

Read more...

How looks like a tuple in Swift? What is touple? Touples and Swift 5.1

Posted on November 19th, 2019 in Swift by George

 

Touples are used for grouping data.

You can think of it as a data structure much like an array.

Check out in the article a Swift example with explanatory comments.

Read more...

Categories