Category Archives: Swift

SwiftUI – How to show a sheet view modally

By | 28/08/2020

In this post, we will see how to show a sheet view modally in Swift, after pressing a Button. We start creating a SwiftUI view called Page2, that it will be the sheet view: [PAGE2.SWIFT] Then, we define the started page called ContentView, where we will add a button used to show the Page2 view:

SwiftUI – Slider

By | 12/08/2020

In this post, we will see how to create and manage a Slider in Swift, with a min value equal to 0 and a max value equal to 10 (with a step of 1). Moreover, every time Slider will change value, the app will run a method. We open Xcode, we create a “Single View… Read More »

SwiftUI – Custom Botton style

By | 21/07/2020

In this post, we will see how to create a custom button style in Swift. First of all, we create a swift project and we add, in the file ContentView, this code: [CONTENTVIEW.SWIFT] Obviously the application is very easy, but it isn’t the principal goal of the the post. If we run the application, this… Read More »

Swift – Unit Test

By | 17/07/2020

In this post, we will see how to create a Unit Test in Swift, in order to test a function called IsNumberEven used to check if a number in input is either even or odd. First of all, we create a Swift file called Core, where we will define the function IsNumberEven: [CORE.SWIFT] Obviously function… Read More »

SwiftUI – TabView

By | 19/06/2020

In this post, we will see how to create a TabView, used to show two different Pages. We start, creating two SwiftUI views called Page1 and Page2: [PAGE1.SWIFT] [Page2.swift] Then, we will add another SwiftUI view called TabMenu where, we will define the TabView: [TABMENU.SWIFT] We have done and, if we run the application, this… Read More »

SwiftUI – Picker

By | 27/05/2020

In this post, we will see how to add a Picker for selecting Sex in the form created in: How to create a Form First of all, we define an array with all the items to display in the picker and then we define a variable where we will save the Picker’s item chosen: Then,… Read More »

SwiftUI – How to create a Form

By | 13/05/2020

In this post, we will see how to create a Form in Swift. We start creating a file called PageForm.swift and then, we set it as starter page, changing the file SceneDelegate.swift: [PAGEFORM.SWIFT] If we run the application, this will be the result:

SwiftUI – Detail View

By | 18/11/2019

SwiftUI – Master and Detail In this post, we will see how to create and use a Detail View in a List.A Detail View is nothing but a Swift file where, we can define the style and what we want to display in a List. Let’s start by taking the code used in the file… Read More »

SwiftUI – Master and Detail

By | 04/11/2019

In this post, we will see how to create a View Detail, using the dynamic list created in the post: SwiftUI – Static and Dynamic List. First of all, we modify the struct User adding a new property called “Info”: Then, we create a SwiftUI View called “DetailUser” that, we will use to show the… Read More »