HomeiOS Developmentios - Padding could or is probably not added in SwiftUI

ios – Padding could or is probably not added in SwiftUI


https://developer.apple.com/tutorials/sample-apps/aboutme

import SwiftUI

struct FunFactsView: View {

    @State non-public var funFact = ""
    var physique: some View {
        GeometryReader { geometry in
            VStack {
                Textual content("Enjoyable Info")
                    .font(.largeTitle)
                    .fontWeight(.daring)
                            
                Textual content(funFact)
                    .padding()
                    .font(.title)
                    .body(minHeight: 400)

                Button("Present Random Truth") {
                    funFact = info.funFacts.randomElement()!
                }
            }
            .padding(20)
        }
    }
}

I anticipated the above code so as to add padding across the VStack, however it does not.(iOS actual machine)
Clearly no padding has been added because the beginning place of the character touches the left fringe of the display.

import SwiftUI


struct StoryView: View {
    var physique: some View {
        VStack {
            Textual content("My Story")
                .font(.largeTitle)
                .fontWeight(.daring)
                .padding()
            
            ScrollView {
                Textual content(info.story)
                    .font(.physique)
                    .padding()
            }
        }
        .padding(50)
    }
}

For StoryView.swift, padding is added as anticipated with the above code.
Am i lacking one thing?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments