-
Notifications
You must be signed in to change notification settings - Fork 522
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
Add some UI customization options #384
base: development
Are you sure you want to change the base?
Changes from all commits
63b0d4a
97a585b
e5727d1
e267b7d
d41ac7c
7f2afb0
dc86c8a
0550d0f
8bf00e0
f803a06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ DerivedData | |
# Pods/ | ||
.idea | ||
/Tests/FailureDiffs | ||
xcshareddata | ||
.build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "DynamicBlurView", | ||
"repositoryURL": "https://github.com/KyoheiG3/DynamicBlurView.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "fbf91352ff3defee8e1fc7525696404bc3740a86", | ||
"version": "5.0.4" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// swift-tools-version:5.1 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
// This comment is necessary, and every Package.swift file | ||
// must start with it. | ||
// It tells SPM which version to use. | ||
// It doesn't have to be the same version as your code, | ||
// but it should be compatible. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "PopupDialog", | ||
// Which platforms and minimum deployment targets are supported | ||
// See: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#supportedplatform | ||
platforms: [ | ||
.iOS(.v12) | ||
], | ||
// The externaly visible build artifacts | ||
// See: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#product | ||
products: [ | ||
// Products define the executables and libraries produced by a package, and make them visible to other packages. | ||
// The library that you can actually import | ||
.library( | ||
name: "PopupDialog", | ||
targets: ["PopupDialog"]) | ||
], | ||
// Your package might need other packages. | ||
// Due to being decentralized you have to tell SPM where to look. | ||
dependencies: [ | ||
// Dependencies declare other packages that this package depends on. | ||
// .package(url: /* package url */, from: "1.0.0"), | ||
.package(url: "https://github.com/KyoheiG3/DynamicBlurView.git", from: "5.0.0") | ||
], | ||
// Targets are the basic building blocks of a package. A target can define a module or a test suite. | ||
// Targets can depend on other targets in this package, and on products in packages which this package depends on. | ||
// See: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#target | ||
targets: [ | ||
|
||
.target( | ||
name: "PopupDialog", | ||
dependencies:[ | ||
.product(name: "DynamicBlurView", package: "DynamicBlurView") | ||
], | ||
path: "PopupDialog/Classes") | ||
] | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,40 @@ final public class PopupDialogContainerView: UIView { | |
} | ||
} | ||
|
||
/// The corner curve of the popup view | ||
@available(iOS 13.0, *) | ||
@objc public dynamic var cornerCurve: CALayerCornerCurve { | ||
get { return shadowContainer.layer.cornerCurve } | ||
set { | ||
shadowContainer.layer.cornerCurve = newValue | ||
container.layer.cornerCurve = newValue | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace) |
||
/// The spacing between buttons | ||
@objc public dynamic var buttonsInterSpacing: CGFloat { | ||
get { return buttonStackView.spacing } | ||
set { | ||
buttonStackView.spacing = newValue | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace) |
||
/// The spacing between buttons and the container view | ||
@objc public dynamic var buttonsContainerSpacing: CGFloat { | ||
get { return buttonStackContainerView.constraints.filter { $0.firstAttribute == .leading }.first?.constant ?? 0 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line Length Violation: Line should be 120 characters or less: currently 121 characters (line_length) |
||
set { | ||
buttonStackContainerView.constraints.filter { $0.firstAttribute == .leading }.first?.constant = newValue | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace) |
||
/// The separator color between buttons and popup content view | ||
@objc public dynamic var separatorColor: UIColor? { | ||
get { return separator.backgroundColor } | ||
set { | ||
separator.backgroundColor = newValue | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace) |
||
// MARK: Shadow related | ||
|
||
/// Enable / disable shadow rendering of the container | ||
|
@@ -126,10 +160,34 @@ final public class PopupDialogContainerView: UIView { | |
buttonStackView.spacing = 0 | ||
return buttonStackView | ||
}() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace) |
||
// The container view for the buttons stack view | ||
internal lazy var buttonStackContainerView: UIView = { | ||
let containerView = UIView() | ||
containerView.translatesAutoresizingMaskIntoConstraints = false | ||
containerView.addSubview(buttonStackView) | ||
NSLayoutConstraint.activate([ | ||
buttonStackView.topAnchor.constraint(equalTo: containerView.topAnchor), | ||
buttonStackView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), | ||
buttonStackView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 5), | ||
buttonStackView.centerXAnchor.constraint(equalTo: containerView.centerXAnchor) | ||
]) | ||
return containerView | ||
}() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace) |
||
// The separator between the popup content and the buttonsStackContainerView | ||
internal lazy var separator: UIView = { | ||
let line = UIView(frame: .zero) | ||
line.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
line.heightAnchor.constraint(equalToConstant: 1) | ||
]) | ||
return line | ||
}() | ||
|
||
// The main stack view, containing all relevant views | ||
internal lazy var stackView: UIStackView = { | ||
let stackView = UIStackView(arrangedSubviews: [self.buttonStackView]) | ||
let stackView = UIStackView(arrangedSubviews: [self.separator, self.buttonStackContainerView]) | ||
stackView.translatesAutoresizingMaskIntoConstraints = false | ||
stackView.axis = .vertical | ||
stackView.spacing = 0 | ||
|
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.
Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)