Skip to content
This repository has been archived by the owner on Jun 17, 2018. It is now read-only.

Adds ability to set selectedView when setting a custom view #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Pod/Classes/MenuItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ open class MenuItemView: UIView {
descriptionWidthConstraint.constant = calculateLabelSize(descriptionLabel, maxWidth: maxWindowSize).width
case let .image(image, selectedImage):
menuImageView.image = isSelected ? (selectedImage ?? image) : image
case .custom: break
case let .custom(view, selectedView):
customView = nil
customView = isSelected ? (selectedView ?? view) : view
}
}
}
Expand Down Expand Up @@ -93,7 +95,7 @@ open class MenuItemView: UIView {
self.setupImageView(image)
self.layoutImageView()
})
case .custom(let view):
case .custom(let view, _):
commonInit({
self.setupCustomView(view)
self.layoutCustomView()
Expand Down
2 changes: 1 addition & 1 deletion Pod/Classes/Protocols/MenuItemViewCustomizable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum MenuItemDisplayMode {
case text(title: MenuItemText)
case multilineText(title: MenuItemText, description: MenuItemText)
case image(image: UIImage, selectedImage: UIImage?)
case custom(view: UIView)
case custom(view: UIView, selectedView: UIView?)
}

public struct MenuItemText {
Expand Down