Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom back button modifier #131

Open
lowryrussell opened this issue Feb 18, 2024 · 4 comments
Open

Custom back button modifier #131

lowryrussell opened this issue Feb 18, 2024 · 4 comments

Comments

@lowryrussell
Copy link

Anyone have a custom navigation back button implementation they're willing to share?

@jedmund
Copy link

jedmund commented May 16, 2024

I'm also interested in this!

@obaida-mostarihi
Copy link

@lowryrussell I had to clone the repository and make my own implementation for that, i changed the base code, if you're interested i can share with you how i did it

@trinvh
Copy link

trinvh commented Sep 25, 2024

@obaida-mostarihi I'm interested as well. Could you please share?

@obaida-mostarihi
Copy link

@trinvh First of all i don't recommend using this library since it does not support new ios versions, it's so outdated it has a lot of navigation bugs, it's still using NavigationView instead of NavigationStack, but here's how you can add the hideBackButton:

once you fork the repository go to the package in folder "NavigationCoordinatable" and file "NavigationCoordinatable" add to the protocol this line
var navigationBarHidden: Bool { get }

in the same class you'll find an extension for NavigationCoordinatable add this line

  var navigationBarHidden: Bool {
        return false
    }

then in "PresentationHelper" file under "NavigationCoordinatable" folder, inside the switch statement find case .push and change it into the following:

               if presentable is AnyView {
                        let view = AnyView(NavigationCoordinatableView(id: nextId, coordinator: coordinator))
                        
                        self.presented = Presented(
                            view: AnyView(view.navigationBarBackButtonHidden(coordinator.navigationBarHidden)),
                            type: .push
                        )
                    } else {
                        self.presented = Presented(
                            view: AnyView(presentable.view().navigationBarBackButtonHidden(coordinator.navigationBarHidden)),
                            type: .push
                        )
                    }

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants