HomeiOS Developmentios - Tips on how to add divider/border to footer in SwiftUI...

ios – Tips on how to add divider/border to footer in SwiftUI when utilizing Part(footer: ) contructor


I am attempting so as to add a divider, or some kind of line/border, to distinguish the principle content material on the display screen and the content material I’ve added uisng Part(footer: ). Anytime I attempt to add some kind of divider in FooterView, it goes proper beneath the place the footer meets the principle content material. And I have never been capable of finding something that enables me so as to add a border to the place I create the footer. I’ve hooked up a picture that reveals what I am speaking about. Right here is the code I at present have for creating the footer which I take advantage of in ContentView():

(https://i.stack.imgur.com/L3WyG.jpg)

Part(footer:
FooterView(APIoutput: APIoutput, selectedKey: selectedKey, output: output, selectedView: $selectedView)
)
{
MAIN CONTENT (hidden)
}

That is what my FooterView code appears to be like like:

import SwiftUI

struct FooterView: View {
var APIoutput : [String: [String : [String] ]]
var selectedKey : String
var output : [Hall]
let NoData = [“No Data displayed” : [“Nothing to show”]]
@Binding var selectedView: Int

//for checking display screen is large enough to suit footer with out padding
@State var isLargeDevice: Bool = {
    if UIScreen.major.bounds.top > 800 {
        return true
    } else {
        return false
    }
}()

var physique: some View {
    if isLargeDevice{
            VStack{
                if selectedView == 1 {
                    VStack {
                        BannerAd(unitID: hidden)
                    }.body(top: 45)
                        .padding(.backside, 5)
                }
                Divider()
                HStack {
                    Button(motion: {
                        // set chosen view to 0 when the left button is clicked
                        selectedView = 0
                    }, label: {
                        Picture(systemName: "fork.knife")
                            .font(.title2)
                            .foregroundColor(selectedView == 0 ? Coloration("NavBar coloration") : .major)
                    }).body(maxWidth: .infinity)

                    
                    Button(motion: {
                        // set chosen view to 1 when the fitting button is clicked
                        selectedView = 1
                    }, label: {
                        Picture(systemName: "coronary heart.fill")
                            .font(.title2)
                            .foregroundColor(selectedView == 1 ? Coloration("NavBar coloration") : .major)
                    }).body(maxWidth: .infinity)
                }
            }
    }
    else {
        ZStack{
            VStack{
                if selectedView == 1 {
                    VStack {
                        BannerAd(unitID: hidden)
                    }.body(top: 45)
                        .padding(.backside, 5)
                }
                Divider()
                HStack {
                    Button(motion: {
                        // set chosen view to 0 when the left button is clicked
                        selectedView = 0
                    }, label: {
                        Picture(systemName: "fork.knife")
                            .font(.title2)
                            .foregroundColor(selectedView == 0 ? Coloration("NavBar coloration") : .major)
                    }).body(maxWidth: .infinity)
                        
                    Button(motion: {
                        // set chosen view to 1 when the fitting button is clicked
                        selectedView = 1
                    }, label: {
                        Picture(systemName: "coronary heart.fill")
                            .font(.title2)
                            .foregroundColor(selectedView == 1 ? Coloration("NavBar coloration") : .major)
                    }).body(maxWidth: .infinity)
                }
            }
        }
        .padding()
    }
}

}

I attempted utilizing .overlay, a brilliant skinny rectangle, divider(), the padding modifier to see if that might assist, however none have labored up to now.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments