Skip to content

Added custom navigationBarClass support to NavigationController#1079

Merged
daniel-jonathan merged 1 commit intoCosmicMind:developmentfrom
phlippieb:feature/extensible_navigation_bar_class
Jun 2, 2018
Merged

Added custom navigationBarClass support to NavigationController#1079
daniel-jonathan merged 1 commit intoCosmicMind:developmentfrom
phlippieb:feature/extensible_navigation_bar_class

Conversation

@phlippieb
Copy link
Contributor

@phlippieb phlippieb commented May 25, 2018

#1074

Adds an initializer to NavigationController that takes a custom navigation bar class parameter; this parameter is simply passed to super.

This extends NavigationController with the ability to be initialized with a user-defined subclass of NavigationBar.

@phlippieb
Copy link
Contributor Author

phlippieb commented May 25, 2018

Two other ways I can think of doing this are:

  1. Make the new init a designated initializer, and make the old init (that always passes NavigationBar.self to super) a convenience init.
  2. Give the navigationbarClass parameter a default value of NavigationBar.self

If you prefer either of those, I'll update my PR.

@OrkhanAlikhanov
Copy link
Contributor

Hey @phlippieb , thank you for your contribution. I would go with your first option. Which I guess what you meant should look like this, but with 2-spaced indention just like other parts of the file:

public override convenience init(rootViewController: UIViewController) {
  self.init(rootViewController: rootViewController, navigationBarClass: NavigationBar.self)
}
  
public init(rootViewController: UIViewController, navigationBarClass: AnyClass?) {
  super.init(navigationBarClass: navigationBarClass, toolbarClass: nil)
  setViewControllers([rootViewController], animated: false)
}

If @DanielDahan approves either option, You may remove the commit rebase development branch again and reapply changes and do one clean commit. To be honest, I am not sure about the second option.

Copy link
Member

@daniel-jonathan daniel-jonathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@daniel-jonathan daniel-jonathan merged commit 642bfef into CosmicMind:development Jun 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants