Friday, December 2, 2022
HomeiOS Developmentios - SwiftUI - Replace identify of the button to what mother...

ios – SwiftUI – Replace identify of the button to what mother or father view has on it


I’ve ImageSettingView which Im utilizing a number of locations. After I used this view at a number of place in my challenge it takes static identify all time within the navigationBarItem i.e Textual content(“Picture Collab View”). I wish to give dynamic identify change primarily based on the place mother or father view it comes from.

ImageColorView -> ImageSettingView (Again NavButon textual content – ImageColor ) ProfilePictureView -> ImageSettingView (Again NavButon textual content – ProfilePictureView )

Pattern code of ImageSettingView :-

struct ImageSettingView : View {


 var physique: some View {
        GeometryReader { geometry in
            VStack {
                Type {
                Textual content("Picture View")
                }
                .navigationBarBackButtonHidden(true)
                .navigationBarItems(
                    main:
                        Button(motion: {
                            onUserImage()
                        }) {
                            HStack {
                                Picture(systemName: "backward")
                                Textual content("Picture")
                                // I wish to use change above textual content primarily based on what identify of the mother or father view was
                            }
                        },
                    trailing:
                        Button(motion: {
                            onDelete()
                        }) {
                            HStack {
                                Textual content("Delete")
                            }
                        }
                )
             
            }
        }
    }

Pattern picture of mock up
enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments