Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into kve/move-to-type-base…
Browse files Browse the repository at this point in the history
…d-layout-storage-on-sub-content

* origin/main:
  Prep 0.14.2
  Update changelog for swipe actions fix
  Respect the swipe actions configuration (#254)
  • Loading branch information
kyleve committed Jan 22, 2021
2 parents 4e927d8 + 3ce6b55 commit bfde185
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion BlueprintUILists.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'BlueprintUILists'
s.version = '0.14.1'
s.version = '0.14.2'
s.summary = 'Declarative list views for iOS apps that deploy back to iOS 11.0.'
s.homepage = 'https://github.com/kyleve/Listable'
s.license = 'Apache License, Version 2.0'
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

# Past Releases

# [0.14.2] - 2020-01-21

### Fixed

- `SwipeActionsConfiguration.performsFirstActionWithFullSwipe` is now respected when set to `false`.

# [0.14.1] - 2020-01-06

### Fixed
Expand Down Expand Up @@ -269,7 +275,8 @@
Earlier releases were ad-hoc and not tracked. To see all changes, please reference [closed PRs on Github](https://github.com/kyleve/Listable/pulls?q=is%3Apr+is%3Aclosed).


[Main]: https://github.com/kyleve/Listable/compare/0.14.1...HEAD
[Main]: https://github.com/kyleve/Listable/compare/0.14.2...HEAD
[0.14.1]: https://github.com/kyleve/Listable/compare/0.14.1...0.14.2
[0.14.1]: https://github.com/kyleve/Listable/compare/0.13.0...0.14.1
[0.13.0]: https://github.com/kyleve/Listable/compare/0.12.1...0.13.0
[0.12.1]: https://github.com/kyleve/Listable/compare/0.12.0...0.12.1
Expand Down
2 changes: 1 addition & 1 deletion ListableUI.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'ListableUI'
s.version = '0.14.1'
s.version = '0.14.2'
s.summary = 'Declarative list views for iOS apps that deploy back to iOS 11.0.'
s.homepage = 'https://github.com/kyleve/Listable'
s.license = 'Apache License, Version 2.0'
Expand Down
23 changes: 13 additions & 10 deletions ListableUI/Sources/Internal/ItemCell.ContentViewContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ extension ItemCell {
final class ContentContainerView : UIView {

let contentView : Content.ContentView

private var swipeConfiguration: SwipeConfiguration?

private var swipeState: SwipeActionState = .closed {
didSet {
if oldValue != swipeState {
Expand All @@ -30,7 +30,7 @@ extension ItemCell {
self.contentView = Content.createReusableContentView(frame: bounds)

super.init(frame: frame)

self.addSubview(self.contentView)
}

Expand Down Expand Up @@ -112,7 +112,8 @@ extension ItemCell {
swipeConfiguration = SwipeConfiguration(
panGestureRecognizer: panGestureRecognizer,
swipeView: swipeView,
numberOfActions: actions.actions.count
numberOfActions: actions.actions.count,
performsFirstActionWithFullSwipe: actions.performsFirstActionWithFullSwipe
)
}

Expand All @@ -124,21 +125,22 @@ extension ItemCell {
set(state: .closed)
}
}

private weak var listView : ListView? = nil

@objc private func handlePan(sender: UIPanGestureRecognizer) {

if self.listView == nil {
self.listView = self.firstSuperview(ofType: ListView.self)
}

guard let configuration = swipeConfiguration else { return }

let offsetMultiplier = configuration.numberOfActions == 1 ? 0.5 : 0.7
let performActionOffset = frame.width * CGFloat(offsetMultiplier)
let currentSwipeOffset = -contentView.frame.origin.x
let willPerformAction = currentSwipeOffset > performActionOffset
&& configuration.performsFirstActionWithFullSwipe

if sender.state == .began {
self.listView?.liveCells.perform {
Expand Down Expand Up @@ -194,20 +196,20 @@ extension ItemCell {
}

private func didPerformAction(expandActions: Bool) {

if expandActions {
self.set(state: .expandActions, animated: true)
} else {
self.set(state: .closed, animated: true)
}
}

func performAnimatedClose() {
self.set(state: .closed, animated: true)
}

private func set(state: SwipeActionState, animated: Bool = false) {

swipeState = state

if animated {
Expand Down Expand Up @@ -236,6 +238,7 @@ extension ItemCell {
let panGestureRecognizer: UIPanGestureRecognizer
let swipeView: Content.SwipeActionsView
var numberOfActions: Int
var performsFirstActionWithFullSwipe: Bool
}
}

Expand Down
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ PODS:
- BlueprintUI (0.19.0)
- BlueprintUICommonControls (0.19.0):
- BlueprintUI
- BlueprintUILists (0.14.1):
- BlueprintUILists (0.14.2):
- BlueprintUI
- ListableUI
- BlueprintUILists/Tests (0.14.1):
- BlueprintUILists/Tests (0.14.2):
- BlueprintUI
- ListableUI
- EnglishDictionary (1.0.0.LOCAL)
- ListableUI (0.14.1)
- ListableUI/Tests (0.14.1):
- ListableUI (0.14.2)
- ListableUI/Tests (0.14.2):
- EnglishDictionary
- Snapshot
- Snapshot (1.0.0.LOCAL)
Expand Down Expand Up @@ -45,9 +45,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
BlueprintUI: 0a86c26f7f51bfc8dd37ead2c41d53b72995d318
BlueprintUICommonControls: c177a134b6112a7e08db91b893f0164f49a75a25
BlueprintUILists: 2cac46a7a7276fc69df1dc550b4464706a1ec267
BlueprintUILists: afcc5b470731c70d1c2952ee4c24e6bcd566a2bd
EnglishDictionary: f03968b9382ddc5c8dd63535efbf783c6cd45f1c
ListableUI: 2123d9d9296fdc0b7b099f8cefa869d17e89ebbe
ListableUI: 40e95b6299084145f04b421353612efbf9f50672
Snapshot: cda3414db426919d09f775434b36289c8e864183

PODFILE CHECKSUM: c1209f66d9213201c70fd26a2f0907a6e29e8cbe
Expand Down

0 comments on commit bfde185

Please sign in to comment.