I am developing an application UI with Swift UI, and I would like to remove Back button
from Navigationbar
from whole app. is there any way to remove Back Button
.
Asked
Active
Viewed 1,065 times
0

Matloob Hasnain
- 1,025
- 6
- 21
-
Downvoted because you event looked for the first basic SwiftUI tutorial from Apple – DenFav Jun 12 '19 at 19:49
3 Answers
1
your code is fine and correct, for example you get the step by step implemntation from SwiftUI Developer portal
import SwiftUI
struct ContentView : View {
var body: some View {
VStack {
Text("Target Color Block")
Text("Target Color Block")
Button(action: {
/* handle button action here */ })
{
Text("your Button Name")
.color(.white)
.padding(10)
.background(Color.blue)
.cornerRadius(5)
.shadow(radius: 5)
.clipShape(RoundedRectangle(cornerRadius: 5))
}
}
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif

Anbu.Karthik
- 82,064
- 23
- 174
- 143
-
if you want to perform in label see this : https://stackoverflow.com/questions/56561064/swiftui-multiple-buttons-in-a-list-row – Anbu.Karthik Jun 12 '19 at 12:36
0
You need to start with some SwiftUI tutorials.
SwiftUI is a complete change from UIKit and so buttons no longer have target/actions.
To add a button you can use...
Button(action: { /* Do something here */ }) {
Text("Press me")
}

Fogmeister
- 76,236
- 42
- 207
- 306
0
It's clearly written in the documentation of SwiftUI of how to use it. Also suggest you to watch the Introducing SwiftUI talk from this year WWDC.
struct ContentView : View {
var body: some View {
Button(action: { self.action() }) {
Text("Button Text")
}
}
private func action() {
print("Do magic")
}
}

Viktor Gardart
- 3,782
- 3
- 17
- 24