Below is the code for a tutorial in my app. At the end of the tutorial, there is a button called 'Continue to App'. When this button is pressed, I would like to take the user to my 'storyboardview' however at the moment the button currently performs no action.
Any help would be very much welcomed.
Many thanks...
import Foundation
import SwiftUI
import UIKit
struct CameraHelp: View {
@State private var cameraIndex = 0
private let cameras: [Camera] = Camera.sampleCameras
private let dotAppearance = UIPageControl.appearance()
var body: some View {
TabView(selection: $cameraIndex) {
ForEach(cameras) { camera in
VStack {
Spacer()
CameraView(camera: camera)
Spacer()
//
HStack {
//Spacer()
if camera == cameras.last {
//Button("Continue to App", action: goToZero)
Button("Continue to App", action: GoToApp)
.buttonStyle(.bordered)
}
// else {
// Button("Next", action: incrementCamera)
// .buttonStyle(.borderedProminent)
// }
}
Spacer()
Spacer()
Spacer()
Spacer()
Spacer()
Spacer()
//Spacer()
}
.tag(camera.tag)
}
}
.animation(.easeInOut, value: cameraIndex)// 2
.indexViewStyle(.page(backgroundDisplayMode: .interactive))
.tabViewStyle(PageTabViewStyle())
.onAppear {
dotAppearance.currentPageIndicatorTintColor = .black
dotAppearance.pageIndicatorTintColor = .gray
}
}
// func incrementCamera() {
// cameraIndex += 1
// }
func GoToApp() {
//Tutorial()
var body: some View {
abc()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Tutorial()
}
}
}
// Action on 'Camera' tab:
struct abc: View {
var body: some View {
storyboardview().edgesIgnoringSafeArea(.all) // ViewController (Camera page)
}
}