Skip to content

Commit

Permalink
Merge pull request #15 from bguidolim/color-per-item
Browse files Browse the repository at this point in the history
Added way to set color per item
  • Loading branch information
pedrommcarrasco authored Jun 29, 2021
2 parents 37c8a5c + f1afc70 commit 5c9bb05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Hover.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Hover'
spec.version = '1.3.2'
spec.version = '1.4.0'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.homepage = 'https://github.com/pedrommcarrasco/Hover'
spec.authors = { 'Pedro Carrasco' => 'https://twitter.com/pedrommcarrasco' }
Expand Down
7 changes: 6 additions & 1 deletion Hover/Model/HoverItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ public struct HoverItem {
// MARK: Properties
let title: String?
let image: UIImage?
let color: HoverColor
let onTap: () -> ()

// MARK: Lifecycle
public init(title: String? = nil, image: UIImage?, onTap: @escaping () -> ()) {
public init(title: String? = nil,
image: UIImage?,
color: HoverColor = .color(.white),
onTap: @escaping () -> ()) {
self.title = title
self.image = image
self.color = color
self.onTap = onTap
}
}
2 changes: 1 addition & 1 deletion Hover/UI/HoverItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HoverItemView: UIStackView {
init(with item: HoverItem, configuration: HoverItemConfiguration) {
self.item = item
self.orientation = configuration.initialXOrientation
self.button = HoverButton(with: .color(.white), image: item.image, imageSizeRatio: configuration.imageSizeRatio)
self.button = HoverButton(with: item.color, image: item.image, imageSizeRatio: configuration.imageSizeRatio)

if let font = configuration.font {
self.label.font = font
Expand Down

0 comments on commit 5c9bb05

Please sign in to comment.