Learn Courses My Dashboard

Using an image as button to navigate to different View

Hi, I would like to use an Image as a button to navigate to a different View, so when the user taps the image they will be taken to a different view. I had though this would be fairly simple, as is surely is something that is utilised on a lot of apps, but my googling is taking me down a bit of a worm hole and it seems there is no straight forward method. Am I missing something here? Is this covered in any of the video’s that I may have missed or forgotten?



Hi James, first are you using UIKit or SwiftUI?

If you are referring to SwiftUI then you can do something like this:

struct ContentView: View {
    @State private var isShowingView = false

    var body: some View {
        Button(action: {
            isShowingView = true
        }) {
            Image(systemName: "house")
                .font(.system(size: 100))
        .sheet(isPresented: $isShowingView) {
            ZStack {
                Text("Presented page")

Thanks Chris, this works perfecty for my needs.