Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pedrommcarrasco/Hover
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.2.0
Choose a base ref
...
head repository: pedrommcarrasco/Hover
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Aug 6, 2019

  1. Copy the full SHA
    d673a7f View commit details

Commits on Aug 24, 2019

  1. Update README.md

    pedrommcarrasco authored Aug 24, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f2c3c3e View commit details
  2. Update README.md

    pedrommcarrasco authored Aug 24, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3423ffe View commit details
  3. Create FUNDING.yml

    pedrommcarrasco authored Aug 24, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b59685d View commit details

Commits on Aug 26, 2019

  1. Update README.md

    pedrommcarrasco authored Aug 26, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3a0d121 View commit details

Commits on Oct 3, 2019

  1. Update FUNDING.yml

    pedrommcarrasco authored Oct 3, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ab8fd0d View commit details
  2. Update README.md

    pedrommcarrasco authored Oct 3, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    de59988 View commit details

Commits on Oct 4, 2019

  1. resolved #5 Swift package

    ftp27 committed Oct 4, 2019
    Copy the full SHA
    2d3a109 View commit details

Commits on Oct 5, 2019

  1. Merge pull request #6 from ftp27/master

    resolved #5 Swift package
    pedrommcarrasco authored Oct 5, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    86ae106 View commit details

Commits on Oct 6, 2019

  1. Copy the full SHA
    37eec63 View commit details
  2. Copy the full SHA
    92ebc6d View commit details
  3. Merge pull request #7 from alspirichev/master

    Add shared scheme for project
    pedrommcarrasco authored Oct 6, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9b39410 View commit details

Commits on May 8, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    08ccb08 View commit details

Commits on May 23, 2021

  1. Fix typo on readme sample code and make HoverItem image optional

    Sample code referred to "image" field as "icon". Also, changed HoverItem specification to take image as an optional value.
    alejandro-oria committed May 23, 2021
    Copy the full SHA
    380e6e2 View commit details

Commits on May 24, 2021

  1. Copy the full SHA
    6a82bda View commit details

Commits on May 27, 2021

  1. Merge pull request #14 from alejandro-oria/typos

    Fix typo on readme sample code and make HoverItem image optional
    pedrommcarrasco authored May 27, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    37c8a5c View commit details

Commits on Jun 29, 2021

  1. Copy the full SHA
    4f664fa View commit details
  2. Copy the full SHA
    f1afc70 View commit details
  3. Merge pull request #15 from bguidolim/color-per-item

    Added way to set color per item
    pedrommcarrasco authored Jun 29, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5c9bb05 View commit details

Commits on Jul 2, 2021

  1. Copy the full SHA
    fa87eb4 View commit details
  2. Copy the full SHA
    932e4c5 View commit details
  3. Copy the full SHA
    e453f44 View commit details
  4. Update Hover/Model/HoverConfiguration.swift

    Co-authored-by: Pedro Carrasco <26525777+pedrommcarrasco@users.noreply.github.com>
    bguidolim and pedrommcarrasco authored Jul 2, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    76d2f49 View commit details
  5. Update Hover/Model/HoverConfiguration.swift

    Co-authored-by: Pedro Carrasco <26525777+pedrommcarrasco@users.noreply.github.com>
    bguidolim and pedrommcarrasco authored Jul 2, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    81ebb6a View commit details
  6. Update Hover/UI/HoverView.swift

    Co-authored-by: Pedro Carrasco <26525777+pedrommcarrasco@users.noreply.github.com>
    bguidolim and pedrommcarrasco authored Jul 2, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d63cee4 View commit details
  7. Minor changes

    bguidolim committed Jul 2, 2021
    Copy the full SHA
    e77cdde View commit details
  8. Minor change

    bguidolim committed Jul 2, 2021
    Copy the full SHA
    e8d6c43 View commit details

Commits on Jul 8, 2021

  1. Updated podspec

    bguidolim committed Jul 8, 2021
    Copy the full SHA
    41c1c1e View commit details
  2. Merge pull request #17 from bguidolim/rotate-animation

    Added way to enable rotation animation when expanding items
    pedrommcarrasco authored Jul 8, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4945ea1 View commit details

Commits on Aug 12, 2021

  1. Copy the full SHA
    7919687 View commit details
  2. Bump podspec version

    bguidolim committed Aug 12, 2021
    Copy the full SHA
    1bc80b6 View commit details
  3. Copy the full SHA
    11cee98 View commit details
  4. Copy the full SHA
    3a82741 View commit details
  5. Copy the full SHA
    a2736b8 View commit details
  6. Bump version: 1.6.0

    bguidolim committed Aug 12, 2021
    Copy the full SHA
    c1f96d2 View commit details
  7. Bump version: 2.0.0

    bguidolim committed Aug 12, 2021
    Copy the full SHA
    68ff344 View commit details
  8. Merge pull request #20 from bguidolim/custom-button-spacing

    Custom button padding
    pedrommcarrasco authored Aug 12, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ad4879c View commit details

Commits on Oct 13, 2021

  1. Copy the full SHA
    db8e38f View commit details
  2. Enabling user interaction

    bguidolim committed Oct 13, 2021
    Copy the full SHA
    e14be6d View commit details
  3. Updated podspec

    bguidolim committed Oct 13, 2021
    Copy the full SHA
    50158ad View commit details

Commits on Oct 19, 2021

  1. Merge pull request #21 from bguidolim/tap-gesture-item-label

    Enabling tap gesture to the item label
    pedrommcarrasco authored Oct 19, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c9def49 View commit details
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: pedrommcarrasco
custom: ['https://www.buymeacoffee.com/pedrommcarrasco', 'https://www.paypal.me/pedrommcarrasco']
8 changes: 8 additions & 0 deletions .github/auto_assign-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# If enabled, auto-assigns users when a new issue is created
# Defaults to true, allows you to install the app globally, and disable on a per-repo basis
addAssignees: true

# The list of users to assign to new issues.
# If empty or not provided, the repository owner is assigned
assignees:
- pedrommcarrasco
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Hover (1.2.0)
- Hover (1.3.0)

DEPENDENCIES:
- Hover (from `..`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: ".."

SPEC CHECKSUMS:
Hover: 4d6d452c3f903162730289058e316319e1213566
Hover: 002ceb90624ed4817ddf2021700b9ff33e374002

PODFILE CHECKSUM: 4464a752690793fe72e3febd146ffc7ffb897004

4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/Hover.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.2.0'
spec.version = '2.1.0'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.homepage = 'https://github.com/pedrommcarrasco/Hover'
spec.authors = { 'Pedro Carrasco' => 'https://twitter.com/pedrommcarrasco' }
67 changes: 67 additions & 0 deletions Hover.xcodeproj/xcshareddata/xcschemes/Hover.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "20FB2C6122D7E82300D933D2"
BuildableName = "Hover.framework"
BlueprintName = "Hover"
ReferencedContainer = "container:Hover.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "20FB2C6122D7E82300D933D2"
BuildableName = "Hover.framework"
BlueprintName = "Hover"
ReferencedContainer = "container:Hover.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
18 changes: 15 additions & 3 deletions Hover/Model/HoverConfiguration.swift
Original file line number Diff line number Diff line change
@@ -22,12 +22,14 @@ public struct HoverConfiguration {
public var color: HoverColor
/// Image displayed in the floating button
public var image: UIImage?
/// Define the animation of the HoverButton's image when expding items
public var imageExpandAnimation: ImageExpandAnimation
/// Size of the floating button
public var size: CGFloat
/// Dictates the size of the image shown in any button (imageSize = size * imageSizeRatio)
public var imageSizeRatio: CGFloat
/// Spacing between the floating button to the edges
public var spacing: CGFloat
public var padding: UIEdgeInsets
/// Font used in items' labels
public var font: UIFont?
/// Color of the overlay
@@ -47,20 +49,22 @@ public struct HoverConfiguration {

// MARK: Init
public init(image: UIImage? = nil,
imageExpandAnimation: ImageExpandAnimation = .none,
color: HoverColor = .color(.blue),
size: CGFloat = 60.0,
imageSizeRatio: CGFloat = 0.4,
spacing: CGFloat = 12.0,
padding: UIEdgeInsets = .init(top: 12, left: 12, bottom: 12, right: 12),
font: UIFont? = nil,
dimColor: UIColor = UIColor.black.withAlphaComponent(0.75),
initialPosition: HoverPosition = .bottomRight,
allowedPositions: Set<HoverPosition> = .all) {

self.color = color
self.image = image
self.imageExpandAnimation = imageExpandAnimation
self.size = size
self.imageSizeRatio = imageSizeRatio
self.spacing = spacing
self.padding = padding
self.font = font
self.dimColor = dimColor
self.initialPosition = initialPosition
@@ -78,3 +82,11 @@ struct HoverItemConfiguration {
let initialXOrientation: Orientation.X
}

// MARK: - ImageExpandAnimation
public enum ImageExpandAnimation {
/// No animation
case none

/// Rotate considering the radian value. It considers the X and Y orientation when animating.
case rotate(_ radian: CGFloat)
}
9 changes: 7 additions & 2 deletions Hover/Model/HoverItem.swift
Original file line number Diff line number Diff line change
@@ -13,13 +13,18 @@ public struct HoverItem {

// MARK: Properties
let title: String?
let image: UIImage
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
}
}
18 changes: 9 additions & 9 deletions Hover/Model/HoverPosition.swift
Original file line number Diff line number Diff line change
@@ -41,28 +41,28 @@ extension HoverPosition {
// MARK: - Configuration
extension HoverPosition {

func configurePosition(of guide: UILayoutGuide, inside view: UIView, with spacing: CGFloat) {
func configurePosition(of guide: UILayoutGuide, inside view: UIView, with insets: UIEdgeInsets) {
let positionConstraints: [NSLayoutConstraint]
switch self {
case .topLeft:
positionConstraints = [
guide.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: spacing),
guide.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: spacing)
guide.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: insets.top),
guide.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: insets.left)
]
case .topRight:
positionConstraints = [
guide.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: spacing),
guide.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -spacing)
guide.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: insets.top),
guide.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -insets.right)
]
case .bottomLeft:
positionConstraints = [
guide.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -spacing),
guide.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: spacing)
guide.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -insets.bottom),
guide.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: insets.left)
]
case .bottomRight:
positionConstraints = [
guide.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -spacing),
guide.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -spacing)
guide.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -insets.bottom),
guide.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -insets.right)
]
}
NSLayoutConstraint.activate(positionConstraints)
4 changes: 2 additions & 2 deletions Hover/UI/HoverButton.swift
Original file line number Diff line number Diff line change
@@ -21,11 +21,11 @@ class HoverButton: UIControl {
}

// MARK: Outlets
private var gradientLayer: CAGradientLayer?
private let imageView: UIImageView = .create {
let imageView: UIImageView = .create {
$0.contentMode = .scaleAspectFit
$0.isUserInteractionEnabled = false
}
private var gradientLayer: CAGradientLayer?
private let hightlightView: UIView = .create {
$0.backgroundColor = Constant.highlightColor
$0.isUserInteractionEnabled = false
7 changes: 6 additions & 1 deletion Hover/UI/HoverItemView.swift
Original file line number Diff line number Diff line change
@@ -35,13 +35,14 @@ 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
}

self.label.text = item.title

super.init(frame: .zero)
configure(with: configuration)
}
@@ -77,6 +78,10 @@ private extension HoverItemView {

func setupSubviews() {
button.addTarget(self, action: #selector(onTapInButton), for: .touchUpInside)

let tapGesture = UITapGestureRecognizer(target: self, action: #selector(onTapInButton))
label.addGestureRecognizer(tapGesture)
label.isUserInteractionEnabled = true
}
}

65 changes: 51 additions & 14 deletions Hover/UI/HoverView.swift
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ public class HoverView: UIView {
static let interItemSpacing: CGFloat = 12.0
static let disabledAlpha: CGFloat = 0.75
static let disabledTransform = CGAffineTransform(scaleX: 0.9, y: 0.9)

}

// MARK: State
@@ -76,6 +75,8 @@ public class HoverView: UIView {
}
}

public var onPositionChange: ((HoverPosition) -> ())?

// MARK: Private Properties
private let anchors: [Anchor]
private let configuration: HoverConfiguration
@@ -90,6 +91,8 @@ public class HoverView: UIView {
} else {
adapt(to: currentAnchor)
}

onPositionChange?(currentAnchor.position)
}
}

@@ -131,7 +134,7 @@ public extension HoverView {
let hitView = super.hitTest(point, with: event)
if hitView == self {
onTouchInDim()
return nil
if state == .none { return nil }
}
return hitView
}
@@ -153,7 +156,7 @@ private extension HoverView {

func defineConstraints() {
anchors.forEach {
$0.position.configurePosition(of: $0.guide, inside: self, with: self.configuration.spacing)
$0.position.configurePosition(of: $0.guide, inside: self, with: self.configuration.padding)
NSLayoutConstraint.activate(
[
$0.guide.widthAnchor.constraint(equalToConstant: self.configuration.size),
@@ -244,12 +247,14 @@ private extension HoverView {
}
}
}

private func animate(isOpening: Bool, anchor: Anchor, completion: (() -> Void)? = nil) {
itemsStackView.isUserInteractionEnabled = isOpening

UIViewPropertyAnimator(duration: Constant.animationDuration, curve: .easeInOut) {

let transform = imageExpandTransform(isOpening: isOpening)
UIViewPropertyAnimator(duration: Constant.animationDuration, dampingRatio: Constant.animationDamping) {
self.dimView.alpha = isOpening ? 1.0 : 0.0
self.button.imageView.transform = transform
}.startAnimation()

anchor.position.yOrientation.reverseArrayIfNeeded(itemsStackView.arrangedSubviews).enumerated().forEach { (index, view) in
@@ -270,6 +275,30 @@ private extension HoverView {
animator.startAnimation(afterDelay: Calculator.delay(for: index))
}
}

private func imageExpandTransform(isOpening: Bool) -> CGAffineTransform {
switch configuration.imageExpandAnimation {
case .none:
return .identity

case .rotate(let radianValue):
let factor: CGFloat

switch (currentAnchor.position.xOrientation, currentAnchor.position.yOrientation) {
case (.leftToRight, .bottomToTop),
(.rightToLeft, .topToBottom):
factor = 1
case (.leftToRight, .topToBottom),
(.rightToLeft, .bottomToTop):
factor = -1
}

let rotationValue: CGFloat = radianValue * factor
let rotationTransform = CGAffineTransform(rotationAngle: rotationValue)

return isOpening ? rotationTransform : .identity
}
}
}

// MARK: - Conditional Constraints
@@ -280,20 +309,28 @@ private extension HoverView {
switch anchor.position {
case .topLeft:
itemsStackView.add(arrangedViews: itemViews.reversed(), hidden: true)
stackViewXConstraint = itemsStackView.leadingAnchor.constraint(equalTo: anchor.guide.leadingAnchor, constant: self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.topAnchor.constraint(equalTo: currentAnchor.guide.bottomAnchor, constant: self.configuration.spacing)
stackViewXConstraint = itemsStackView.leadingAnchor.constraint(equalTo: anchor.guide.leadingAnchor,
constant: self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.topAnchor.constraint(equalTo: currentAnchor.guide.bottomAnchor,
constant: self.configuration.padding.bottom)
case .topRight:
itemsStackView.add(arrangedViews: itemViews.reversed(), hidden: true)
stackViewXConstraint = itemsStackView.trailingAnchor.constraint(equalTo: anchor.guide.trailingAnchor, constant: -self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.topAnchor.constraint(equalTo: currentAnchor.guide.bottomAnchor, constant: self.configuration.spacing)
stackViewXConstraint = itemsStackView.trailingAnchor.constraint(equalTo: anchor.guide.trailingAnchor,
constant: -self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.topAnchor.constraint(equalTo: currentAnchor.guide.bottomAnchor,
constant: self.configuration.padding.bottom)
case .bottomLeft:
itemsStackView.add(arrangedViews: itemViews, hidden: true)
stackViewXConstraint = itemsStackView.leadingAnchor.constraint(equalTo: anchor.guide.leadingAnchor, constant: self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.bottomAnchor.constraint(equalTo: currentAnchor.guide.topAnchor, constant: -self.configuration.spacing)
stackViewXConstraint = itemsStackView.leadingAnchor.constraint(equalTo: anchor.guide.leadingAnchor,
constant: self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.bottomAnchor.constraint(equalTo: currentAnchor.guide.topAnchor,
constant: -self.configuration.padding.top)
case .bottomRight:
itemsStackView.add(arrangedViews: itemViews, hidden: true)
stackViewXConstraint = itemsStackView.trailingAnchor.constraint(equalTo: anchor.guide.trailingAnchor, constant: -self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.bottomAnchor.constraint(equalTo: currentAnchor.guide.topAnchor, constant: -self.configuration.spacing)
stackViewXConstraint = itemsStackView.trailingAnchor.constraint(equalTo: anchor.guide.trailingAnchor,
constant: -self.configuration.itemConfiguration.margin)
stackViewYConstraint = itemsStackView.bottomAnchor.constraint(equalTo: currentAnchor.guide.topAnchor,
constant: -self.configuration.padding.top)
}
NSLayoutConstraint.activate([stackViewXConstraint, stackViewYConstraint])

23 changes: 23 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Hover",
platforms: [
.iOS(.v11),
],
products: [
.library(
name: "Hover",
targets: ["Hover"]),
],
dependencies: [],
targets: [
.target(
name: "Hover",
dependencies: [],
path: "Hover"),
]
)
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -43,6 +43,15 @@ And then run the following command in terminal:
carthage update
```

## Swift Package Manager

To include Hover into a Swift Package Manager package, add it to the `dependencies` attribute defined in your `Package.swift` file. For example:
```
dependencies: [
.package(url: "https://github.com/pedrommcarrasco/Hover.git", from: <version>),
]
```

# ⌨️ Usage Example
After installing **Hover**, you should start by importing the framework:

@@ -54,7 +63,7 @@ Once imported, you can start using **Hover** like follows:

```swift
// Create Hover's Configuration (all parameters have defaults)
let configuration = HoverConfiguration(icon: UIImage(named: "add"), color: .gradient(top: .blue, bottom: .cyan))
let configuration = HoverConfiguration(image: UIImage(named: "add"), color: .gradient(top: .blue, bottom: .cyan))

// Create the items to display
let items = [
@@ -87,10 +96,25 @@ For more details about all the parameters that you can configure, take a look in
# 📲 Sample Project
There's a sample project in this repository with some samples of Hover called [Example](https://github.com/pedrommcarrasco/Hover/tree/master/Example).

# ❤️ Support Hover

Hello there 👋

I’m Pedro, a Portuguese iOS Engineer since February 2017. I’m an avid OSS enthusiast and contributor - help by sharing, learn by what’s shared.

I've built and open-sourced multiple frameworks and applications, including **[Brooklyn](https://github.com/pedrommcarrasco/Brooklyn)** and **[CocoaHub](https://cocoahub.app)**.

I'm also a conference and meetup organizer, being part of **[SwiftAveiro](https://swiftaveiro.xyz)** and **[CocoaHeads Porto](https://www.meetup.com/CocoaHeads-Porto/)**.

If you enjoy my work and would like to help me continue it, please consider:
* https://github.com/users/pedrommcarrasco/sponsorship
* https://www.buymeacoffee.com/pedrommcarrasco
* https://www.paypal.me/pedrommcarrasco

# 🙌 Contributing
Feel free to contribute to this project by [reporting bugs](https://github.com/pedrommcarrasco/Hover/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) or open [pull requests](https://github.com/pedrommcarrasco/Hover/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc).

Hover was created for personal use but dynamic enough to be an open-source framework. As such, while functional, it may lack some additional customization. If there's something missing that you need, feel free to ask me here or on [Twitter](https://twitter.com/pedrommcarrasco).

# ⛔ License
Constrictor's available under the MIT license. See the [LICENSE](https://github.com/pedrommcarrasco/Hover/blob/master/LICENSE) file for more information.
Hover's available under the MIT license. See the [LICENSE](https://github.com/pedrommcarrasco/Hover/blob/master/LICENSE) file for more information.