The SwiftUI framework provides the tools you need to create the layout of your app. Two of these are the Spacer and Divider, both of which are views as they conform to the View protocol.

Learn How to Create iOS Apps
The SwiftUI framework provides the tools you need to create the layout of your app. Two of these are the Spacer and Divider, both of which are views as they conform to the View protocol.
When creating iPhone apps you will come across times when you can use single instance of a class across an entire app. Network manager, audio player, and other classes that Apple provides are called Singletons. It is one of the design patterns used in iOS app development.
A singleton ensures that only one instance of the class exists across the entire app. One example is App Settings, and another is a connection to a database where you probably want just a single connection.
Although singletons are relatively easy to create, meaning the syntax to allow a class to be a singleton, you need to be careful how you create it to avoid tight coupling and hidden dependencies.
[Read more…]A long time ago, back in 2013 and just prior to Swift launching, I created a tutorial in Objective-C called AVSpeechSynthesizer Tutorial – Letting Your App Speak Like Siri. A lot of things have changed since then in that we now have Swift, SwiftUI, and personalised voice. People with iPhone 12 or later, and various Mac and iPad devices, can spend time recording phrases on the screen, and after the device has processed those phrases, you then have a personalised voice that can be used in various places on the phone.
This tutorial looks at how to use AVSpeechSynthesizer to select your voice and get yourself to speak anything you type in.
[Read more…]SwiftUI views work with view modifiers that make it really simple to create great effects. In this tutorial, we’ll look at making a rounded profile picture that you might use on a profile page in your app.
This particular profile picture (not me), is created with an Image view with several view modifiers to clip the corners to make a circle as well as add a small border around it. The result looks surprisingly good.
String interpolation is an extremely convenient way to mix variables, constants, and expressions into a string. It is extremely common to use this within your app. In this tutorial we’ll look at how you can use it in your own app.
[Read more…]A class in Swift, like classes in other programming languages, serves as a blueprint for creating objects that encapsulate data and behaviour. In Swift, you will see both classes and structs. This post will primarily focus on classes, although I will mention structs throughout to highlight some of the differences.
Classes are reference types, meaning that if you instantiate it, and then make a copy of it, any changes to either copy will be reflected in the other copy.
class Car {
var model: String
init(model: String) {
self.model = model
}
}
let car1 = Car(model: "Ferrari")
let car2 = car1
car2.model = "Lamborghini"
print(car1.model)
Although we changed car2’s model, because car2 is a copy of car1, and that it copies by reference, any changes to car2 here will also be changing car1.
[Read more…]Parse.com was a MBaaS that shut down in 2017 and became Parse Platform, which is now an open-source version with a thriving community. It is a backend framework for mobile and web applications that you can install on a server and host yourself.
I first started using Parse when it was new, I believe around 2012/2013 on a project building an iPad app for time tracking at various locations on the west coast of the USA.
[Read more…]Context menus provide a simple way of displaying additional actions in response to a long-press on a View item. Some items in your view might require more options, but rather than cluttering a menu or the View with these options, they can be grouped together in a contextMenu.
Since iOS 2, the Core Location framework has provided the way to find a devices geographical location. In this tutorial you’ll learn how to request location permission, retrieve your devices currently location, and display these real-time updates in a SwiftUI app.
Given its age, the Core Location framework has an extensive set of tools that go beyond just finding the users current location. We will look at some of these features today, but also in future tutorials so that you can work with your users location in a way that is suitable for your app.
[Read more…]In this tutorial, we’ll add Buttons to a NavigationStack toolbar and position them correctly according to your needs. To demonstrate what can be done, we’ll add animations to the buttons based on the SF Symbols tutorial.