-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Designable navigation view #981
Conversation
Awesome. Looks great so far! |
7613273
to
d77b77e
Compare
This PR is ready for review. As noted in the description, this change alone won't change anything aside from:
|
public override func prepareForInterfaceBuilder() { | ||
super.prepareForInterfaceBuilder() | ||
|
||
for _ in 0...4 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there are always 4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is only being used when rendering in Interface Builder so 5 mock lanes.
*/ | ||
@IBDesignable | ||
@objc(MBNavigationView) | ||
open class NavigationView: UIView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This namespace is really starting to get crowded 🙈.
weak var muteButton: FloatingButton! | ||
weak var reportButton: FloatingButton! | ||
weak var rerouteReportButton: ReportButton! | ||
weak var separatorView: SeparatorView! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are all these variables used?
weak var informationStackView: UIStackView! | ||
// Vertically laid-out stack view below the information stack view ontop of the map view, docked | ||
// to the top right, consisting of Overview, Mute, and Report button. | ||
weak var floatingStackView: UIStackView! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one major comment I have on this PR is this: Since this is no longer IB-based, it would be much cleaner to use a lazy var
pattern to set up all of these child views, like so:
lazy var floatingStackView: UIStackView = {
let stack = UIStackView()
stack.axis = .vertical
stack.distribution = .equalSpacing
stack.spacing = 8
stack.translatesAutoresizingMaskIntoConstraints = false
return stack
} ()
then, setupViews()
becomes this:
func setupViews() {
[..., floatingStackView, overviewButton, muteButton, reportButton, ...].forEach(addSubview(_:))
}
However, this does work for now, so if we want to just get this across the line then I'll happily take care of it in my PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree about the lazy-loaded ivars. Even more if we decide to lazy-load localized strings. However, I'm going to merge this as is b/c the utilization of this class will be done in a subsequent PR which is when we can measure the impact.
This PR adds a new
NavigationView
which will replace theRouteMapViewController
’s view that's currently laid-out in the storyboard. A designable view of the whole UI encapsulating all other views.Hooking it up to
RouteMapViewController
will be done in a subsequent PR so this change alone won't effectively change anything aside from:WayNameView
merged intoWayNameLabel
LanesContainerView
toLanesView
@JThramer @bsudekum 👀