I am trying to navigate to a View Controller while currently using NavigationLink from SwiftUI. I am assuming I am not able to do this, so I am wondering how I can navigate to my View Controller in another way while still being able to click on a button from my HomeView and navigate to my ViewController.
Below is my HomeView where I want a button with the text 'Time Sheets' to navigate to my ViewController
struct HomeView: View {
var body: some View {
NavigationView {
VStack {
Image("OELogo")
.resizable()
.frame(width: 400, height: 300)
NavigationLink(destination: ViewController()) {
Text("Time Sheets")
.fontWeight(.bold)
.frame(minWidth: 325, minHeight: 50)
.font(.title)
.foregroundColor(.gray)
.padding()
.overlay(
RoundedRectangle(cornerRadius: 50)
.stroke(Color.gray, lineWidth: 2)
)
}
Below is the start to my code of ViewController file that I want to navigate to
import UIKit
import KVKCalendar
import SwiftUI
final class ViewController: UIViewController {
private var events = [Event]()
private var selectDate: Date = {
let formatter = DateFormatter()
formatter.dateFormat = "dd.MM.yyyy"
return formatter.date(from: "27.7.2020") ?? Date()
}()```