Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### Fixed

- Fixed warning in Package.swift referencing a non-existent Resources directory.
- Fixed warning for a cross-module protocol conformance.
- Fixed deprecation warning by adopting `UIButton.Configuration` for swipe action buttons.

### Added

### Removed
Expand Down
35 changes: 27 additions & 8 deletions ListableUI/Sources/Internal/SwipeActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,41 @@ private class DefaultSwipeActionButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)

titleLabel?.font = .systemFont(ofSize: 15, weight: .medium)
titleLabel?.lineBreakMode = .byTruncatingTail
var configuration = UIButton.Configuration.plain()
configuration.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: inset, bottom: 0, trailing: inset)
configuration.titleLineBreakMode = .byTruncatingTail
configuration.titleAlignment = .center
self.configuration = configuration

titleLabel?.numberOfLines = 2
titleLabel?.minimumScaleFactor = 0.8
titleLabel?.adjustsFontSizeToFitWidth = true
titleLabel?.textAlignment = .center
contentEdgeInsets = UIEdgeInsets(top: 0, left: inset, bottom: 0, right: inset)

addTarget(self, action: #selector(onTap), for: .primaryActionTriggered)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func updateConfiguration() {
super.updateConfiguration()

if let title = action?.title, let color = action?.tintColor {
configuration?.attributedTitle = AttributedString(
title,
attributes: AttributeContainer([
.font: UIFont.systemFont(ofSize: 15, weight: .medium),
.foregroundColor: color,
]),
)
} else {
configuration?.attributedTitle = nil
}

configuration?.image = action?.image
}

func set(action: SwipeAction, didPerformAction: @escaping SwipeAction.OnDidPerformAction) {
self.action = action

Expand All @@ -289,10 +310,8 @@ private class DefaultSwipeActionButton: UIButton {
// an incorrect visual appearance.

tintColor = action.tintColor

setTitle(action.title, for: .normal)
setTitleColor(action.tintColor, for: .normal)
setImage(action.image, for: .normal)

setNeedsUpdateConfiguration()

accessibilityLabel = action.accessibilityLabel
accessibilityValue = action.accessibilityValue
Expand Down
2 changes: 1 addition & 1 deletion ListableUI/Sources/ListScrollPositionInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ extension UIEdgeInsets
}
}

extension UIRectEdge : CustomDebugStringConvertible
extension UIRectEdge : Swift.CustomDebugStringConvertible
{
static func visibleScrollViewContentEdges(
bounds : CGRect,
Expand Down
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ let package = Package(
path: "BlueprintUILists",
exclude: [
"Tests",
],
resources: [
.process("Resources"),
]
),
],
Expand Down
Loading