Skip to content
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

introduce border width #136

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions Classes/Popover.swift
Expand Up @@ -25,6 +25,7 @@ public enum PopoverOption {
case initialSpringVelocity(CGFloat)
case sideOffset(CGFloat)
case borderColor(UIColor)
case borderWidth(CGFloat)
}

@objc public enum PopoverType: Int {
Expand Down Expand Up @@ -56,6 +57,7 @@ open class Popover: UIView {
open var initialSpringVelocity: CGFloat = 3
open var sideOffset: CGFloat = 6.0
open var borderColor: UIColor?
open var borderWidth: CGFloat = 1.0

// custom closure
open var willShowHandler: (() -> ())?
Expand Down Expand Up @@ -495,6 +497,9 @@ open class Popover: UIView {

color.setFill()
arrow.fill()

arrow.lineWidth = borderWidth

if let borderColor = borderColor {
borderColor.setStroke()
arrow.stroke()
Expand Down Expand Up @@ -538,6 +543,8 @@ private extension Popover {
self.sideOffset = value
case let .borderColor(value):
self.borderColor = value
case let .borderWidth(value):
self.borderWidth = value
}
}
}
Expand Down