The code below shows the GUI for my app, however none of the buttons on my storyboard are clickable. This code forms part of my A-level computer science project and all help will be very much welcomed.
The code for my GUI is shown below:
//
// ContentView.swift
// Custom app bar 3
//
// Created by ### on 08/09/2022.
//
import SwiftUI
import UIKit
import MapKit
struct ContentView100: View {
@State var selected = 2 // The app will open on this page.
var body: some View {
TabView(selection: $selected) {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Button(action: {}) {
//HapticsManager.shared.vibrate(for: .success)
ContentView5().edgesIgnoringSafeArea(.all) // Naviagtion Stacks (Help page)
}
.tabItem {
Image(systemName: "questionmark.circle.fill")
Text("Help")
}.tag(0) //On menu bar
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Button(action: {}) {
//HapticsManager.shared.vibrate(for: .success)
storyboardview2().edgesIgnoringSafeArea(.all) // ViewController2 (Photos page)
}
.tabItem {
Image(systemName: "photo")
Text("Photos")
}.tag(1) //On menu bar
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Button(action: {}) {
//HapticsManager.shared.vibrate(for: .success)
storyboardview().edgesIgnoringSafeArea(.all) // ViewController (Camera page)
}
.tabItem {
Image(systemName: "camera")
Text("Camera")
}.tag(2) //On menu bar
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Button(action: {}) {
// HapticsManager.shared.vibrate(for: .success)
storyboardview3().edgesIgnoringSafeArea(.all) // ViewController3 = OCR - does not belog here (History page)
}
.tabItem {
Image(systemName: "clock")
Text("History")
}.tag(3) //On menu bar
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Button(action: {}) {
// HapticsManager.shared.vibrate(for: .success)
Tutorial().edgesIgnoringSafeArea(.all) // Tutorial - does not belong here (Settings page)
}
.tabItem {
Image(systemName: "gearshape")
Text("Settings")
}.tag(4) //On menu bar
}
}
struct Company: Identifiable, Hashable {
var id = UUID()
let ticker: String
}
struct storyboardview: UIViewControllerRepresentable{
func makeUIViewController(context content: Context) -> UIViewController {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let controller = storyboard.instantiateViewController(identifier: "takePhoto")
return controller
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}
struct storyboardview2: UIViewControllerRepresentable{
func makeUIViewController(context content: Context) -> UIViewController {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main) //Working
let controller = storyboard.instantiateViewController(identifier: "selectPhoto") //Working
return controller //Working
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}
}
the code you have posted does not compile - ContentView5 and Tutorial are missing. The PreviewProvider is missing - usually this builds your ContentView, but for some reason you have a ContentView100.
It would be easier to read your code if you posted inside a code block (see the little icons at the bottom of the Your Reply pane).
Try again and maybe someone can help you out!