Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Add explanation/description text below a setting in SwiftUI

In SwiftUI, what is the standard way (or the recommended way) to add "explanation" text to a setting. For example, in the screen shot below of the system Maps app’s settings, the Speed Limit toggle has the following explanation text beneath it:

Speed limit information will be shown when available.

settings screen shot

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you want something like the image you posted try Form. It can contain multiple Section where you can provide a header and a footer View.

documentation

Example:

struct TestView: View{
    var body: some View{
        Form{
            Section {
                Text("content")
            } header: {
                Text("header")
            } footer: {
                Text("footer")
            }
        }

    }
}

exmaple

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading