Category Archives: Swift

Swift – Core Data

By | 30/11/2022

In this post, we will see how to use Core Data in an iOS project.But first if all, what is Core Data?From Apple web site:“Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle… Read More »

Swift – Class (Part II)

By | 30/03/2022

Swift – Class (Part I) MULTIPLE INITIALIZERS If we run this code, these will be the results: DEINITIALIZERDeinitialization is a process used to deallocate the memory space before a class instance deallocated. The ‘deinit’ keyword is used to deallocate the memory spaces occupied by the system resources. If we run this code, these will be… Read More »

Swift – Struct

By | 09/03/2022

In this post, we will see how to use Struct in Swift.But first of all, what is a Struct?:From Apple web site: “Use structures to represent common kinds of data. Structures in Swift include many features that are limited to classes in other languages: They can include stored properties, computed properties, and methods. Moreover, Swift… Read More »

Swift – Throwing functions

By | 02/03/2022

In this post, we will see how to use Throwing functions to handle errors in our code. We start opening Xcode and we create a Playground file called Errors where, we will define a simple method “Divide” to divide two number greater than 1: If we run the code, this will be the result: The… Read More »

SwiftUI – MVVM

By | 14/07/2021

In this post, we will see how to implement MVVM pattern in SwiftUI.But, what is MVVM pattern?From wikipedia:“Model–view–viewmodel (MVVM) is a software architectural pattern that facilitates the separation of the development of the graphical user interface (the view) – be it via a markup language or GUI code – from the development of the business logic or back-end logic (the model) so that the view is not dependent on any… Read More »

SwiftUI – How to show an Alert

By | 03/02/2021

In this post, we will see how to implement an Alert in SwiftUI. We create a project called AlertTest and add this code in the file ContentView: [CONTENTVIEW.SWIFT] This is all and now, if we run the application, this will be the result: