Skip to content

Commit 27f650d

Browse files
authored
Merge pull request #201 from surfstudio/SPT-1160-Add-the-ability-to-expand-cells-without-animation
Добавить возможность развертывания ячеек без анимации
2 parents 1baf052 + 0fb5dbd commit 27f650d

35 files changed

+301
-225
lines changed

Brewfile.lock.json

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,86 @@
22
"entries": {
33
"tap": {
44
"homebrew/cask": {
5-
"revision": "49a1cf9695aeafce09b6566a6f0ab6b062a03566"
5+
"revision": "3ece2c193e9019ec49037b8f829ab42d88ece146"
66
},
77
"yonaskolb/xcodegen": {
8-
"revision": "87d7c7e136caf6392738096dae0568355a0619e3",
8+
"revision": "3327c44ad74c1e04e0de1e8ecca0d7114a613765",
99
"options": {
1010
"clone_target": "https://github.com/yonaskolb/XcodeGen.git"
1111
}
1212
},
1313
"krzysztofzablocki/sourcery": {
14-
"revision": "544b639edb9a75b71d773cc5ae7e2c77173aaf34",
14+
"revision": "3a9e5f1014ac09b30727c01d2a0e1531dac30948",
1515
"options": {
1616
"clone_target": "https://github.com/krzysztofzablocki/Sourcery.git"
1717
}
1818
}
1919
},
2020
"brew": {
2121
"xcodegen": {
22-
"version": "2.29.0",
22+
"version": "2.33.0",
2323
"bottle": {
2424
"rebuild": 0,
2525
"root_url": "https://ghcr.io/v2/homebrew/core",
2626
"files": {
27+
"arm64_ventura": {
28+
"cellar": ":any_skip_relocation",
29+
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:76d47e558129e02cb16dbcdbb92b25ac5ab47658f4736cd1f68d205bebcd0001",
30+
"sha256": "76d47e558129e02cb16dbcdbb92b25ac5ab47658f4736cd1f68d205bebcd0001"
31+
},
2732
"arm64_monterey": {
2833
"cellar": ":any_skip_relocation",
29-
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:22d97109850126936386bc38a22459d9e8ac3ba1e00b254f5149e954f543c2ec",
30-
"sha256": "22d97109850126936386bc38a22459d9e8ac3ba1e00b254f5149e954f543c2ec"
34+
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:092164ce460d49adbc33023f55ec6b9a5704d787e18c05ac7d62232c47bdc91e",
35+
"sha256": "092164ce460d49adbc33023f55ec6b9a5704d787e18c05ac7d62232c47bdc91e"
3136
},
3237
"arm64_big_sur": {
3338
"cellar": ":any_skip_relocation",
34-
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:ab30a37ef8e3c885b1cd05c30a844612237f52308556256cb4698784d00a2ad4",
35-
"sha256": "ab30a37ef8e3c885b1cd05c30a844612237f52308556256cb4698784d00a2ad4"
39+
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:b4ba5b91c37a2b3b364a5af35d207eac215a2c00987d008a3002a9d643d39652",
40+
"sha256": "b4ba5b91c37a2b3b364a5af35d207eac215a2c00987d008a3002a9d643d39652"
3641
},
37-
"monterey": {
42+
"ventura": {
3843
"cellar": ":any_skip_relocation",
39-
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:6ef4431936bc868e8026c9ddb8396fa5ac2d9d53a611a59b23fc081d3a5ad0bb",
40-
"sha256": "6ef4431936bc868e8026c9ddb8396fa5ac2d9d53a611a59b23fc081d3a5ad0bb"
44+
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:38a9e261286f6f7e402eef108a6b0fc02884a9872d9464d69a56b1adc725c7fe",
45+
"sha256": "38a9e261286f6f7e402eef108a6b0fc02884a9872d9464d69a56b1adc725c7fe"
4146
},
42-
"big_sur": {
47+
"monterey": {
4348
"cellar": ":any_skip_relocation",
44-
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:4c990bf05734cbb192171079d69e996837092603985c41904ddec799aa51fcbe",
45-
"sha256": "4c990bf05734cbb192171079d69e996837092603985c41904ddec799aa51fcbe"
49+
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:a05217b82deaa2efa0ee832b663232aab66aabe2d2c08ad2e3fde723b6faffb0",
50+
"sha256": "a05217b82deaa2efa0ee832b663232aab66aabe2d2c08ad2e3fde723b6faffb0"
4651
},
47-
"catalina": {
52+
"big_sur": {
4853
"cellar": ":any_skip_relocation",
49-
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:330bf63ef11b30bde8f32aea2d46604fd16bcfcff1b918ab95fe294ea9f3708a",
50-
"sha256": "330bf63ef11b30bde8f32aea2d46604fd16bcfcff1b918ab95fe294ea9f3708a"
54+
"url": "https://ghcr.io/v2/homebrew/core/xcodegen/blobs/sha256:f5b9313d25bff493ea073b291c2a86d3633cc16ec331fa3d2caf8a1131247bbb",
55+
"sha256": "f5b9313d25bff493ea073b291c2a86d3633cc16ec331fa3d2caf8a1131247bbb"
5156
}
5257
}
5358
}
5459
},
5560
"sourcery": {
56-
"version": "1.9.0",
61+
"version": "1.9.2",
5762
"bottle": {
5863
"rebuild": 0,
5964
"root_url": "https://ghcr.io/v2/homebrew/core",
6065
"files": {
66+
"arm64_ventura": {
67+
"cellar": ":any_skip_relocation",
68+
"url": "https://ghcr.io/v2/homebrew/core/sourcery/blobs/sha256:37f85dd2fc0091ba35abf1bc059ac2ab9eb7490955b327445f52d5c92a26fd44",
69+
"sha256": "37f85dd2fc0091ba35abf1bc059ac2ab9eb7490955b327445f52d5c92a26fd44"
70+
},
6171
"arm64_monterey": {
6272
"cellar": ":any_skip_relocation",
63-
"url": "https://ghcr.io/v2/homebrew/core/sourcery/blobs/sha256:0f8ad70cf4d9dba61f8621513dc8db1c25bcee74c0a2da3a1013763e37add80c",
64-
"sha256": "0f8ad70cf4d9dba61f8621513dc8db1c25bcee74c0a2da3a1013763e37add80c"
73+
"url": "https://ghcr.io/v2/homebrew/core/sourcery/blobs/sha256:5bd5a098011084a2eb0a967382a93997975535195badd3ad5807e3cd19fdcf6e",
74+
"sha256": "5bd5a098011084a2eb0a967382a93997975535195badd3ad5807e3cd19fdcf6e"
75+
},
76+
"ventura": {
77+
"cellar": ":any_skip_relocation",
78+
"url": "https://ghcr.io/v2/homebrew/core/sourcery/blobs/sha256:3be6812ef327e5e0d9ba0b52c6809e89ec74a4effdcefc4968f7fbc369efcbe2",
79+
"sha256": "3be6812ef327e5e0d9ba0b52c6809e89ec74a4effdcefc4968f7fbc369efcbe2"
6580
},
6681
"monterey": {
6782
"cellar": ":any_skip_relocation",
68-
"url": "https://ghcr.io/v2/homebrew/core/sourcery/blobs/sha256:9cc7c91be67833c608e94ec72d57531a86953318e97ec751bcaf86daf798c263",
69-
"sha256": "9cc7c91be67833c608e94ec72d57531a86953318e97ec751bcaf86daf798c263"
83+
"url": "https://ghcr.io/v2/homebrew/core/sourcery/blobs/sha256:26816c3345810c1b3e154dbdb6b273ea59ba87394dc9773092beee1d223ff0b6",
84+
"sha256": "26816c3345810c1b3e154dbdb6b273ea59ba87394dc9773092beee1d223ff0b6"
7085
}
7186
}
7287
}
@@ -90,6 +105,14 @@
90105
"CLT": "12.5.1.0.1.1623191612",
91106
"Xcode": "13.2.1",
92107
"macOS": "11.5.1"
108+
},
109+
"ventura": {
110+
"HOMEBREW_VERSION": "3.6.15-53-g4534748",
111+
"HOMEBREW_PREFIX": "/usr/local",
112+
"Homebrew/homebrew-core": "d0befea5025acac52ece7e6c67966708f025c2af",
113+
"CLT": "",
114+
"Xcode": "14.2",
115+
"macOS": "13.0.1"
93116
}
94117
}
95118
}

Example/ReactiveDataDisplayManager/Table/AllPluginsTableViewController/AllPluginsTableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private extension AllPluginsTableViewController {
104104

105105
func addExpandableSection() {
106106
addHeaderGenerator(with: "Expandable")
107-
let generator = ExpandableTableCell.rddm.baseGenerator(with: ())
107+
let generator = ExpandableTableCell.rddm.baseGenerator(with: true)
108108
adapter.addCellGenerator(generator)
109109
}
110110

Example/ReactiveDataDisplayManager/Table/Views/Cells/ExpandableTableCell/ExpandableTableCell.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ class ExpandableTableCell: UITableViewCell, ExpandableItem {
1919

2020
private var isSmall = true
2121

22-
// MARK: - Public Properties
22+
// MARK: - ExpandableItem Properties
2323

2424
public var onHeightChanged: BaseEvent<CGFloat?> = .init()
25+
public var animatedExpandable = true
2526

2627
// MARK: - @IBActions
2728

@@ -31,13 +32,18 @@ class ExpandableTableCell: UITableViewCell, ExpandableItem {
3132
isSmall.toggle()
3233
}
3334

35+
@IBAction private func switchAnimated(_ sender: UISwitch) {
36+
animatedExpandable = sender.isOn
37+
}
38+
3439
}
3540

3641
// MARK: - ConfigurableItem
3742

3843
extension ExpandableTableCell: ConfigurableItem {
3944

40-
func configure(with model: ()) {
45+
func configure(with animated: Bool) {
46+
self.animatedExpandable = animated
4147
button.layer.cornerRadius = 20
4248
button.clipsToBounds = true
4349
}

Example/ReactiveDataDisplayManager/Table/Views/Cells/ExpandableTableCell/ExpandableTableCell.xib

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="System colors in document resources" minToolsVersion="11.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -25,17 +25,25 @@
2525
<constraint firstAttribute="height" constant="50" id="VnP-p5-jxg"/>
2626
</constraints>
2727
<state key="normal" title="Button"/>
28-
<buttonConfiguration key="configuration" style="plain" title="Изменить размер">
28+
<buttonConfiguration key="configuration" style="plain" title="Анимированно ">
2929
<color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
3030
</buttonConfiguration>
3131
<connections>
3232
<action selector="buttonTap:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="d5C-VL-9Es"/>
3333
</connections>
3434
</button>
35+
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Srq-MG-Ccz">
36+
<rect key="frame" x="272" y="43" width="0.0" height="0.0"/>
37+
<connections>
38+
<action selector="switchAnimated:" destination="KGk-i7-Jjw" eventType="valueChanged" id="Per-G4-XZk"/>
39+
</connections>
40+
</switch>
3541
</subviews>
3642
<constraints>
43+
<constraint firstItem="hU3-WF-wob" firstAttribute="trailing" secondItem="Srq-MG-Ccz" secondAttribute="trailing" constant="8" id="0zh-mu-eZb"/>
3744
<constraint firstItem="hU3-WF-wob" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="16" id="Drz-1h-EoZ"/>
3845
<constraint firstAttribute="trailing" secondItem="hU3-WF-wob" secondAttribute="trailing" constant="16" id="GaH-tC-OIO"/>
46+
<constraint firstItem="Srq-MG-Ccz" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="OB1-mY-IeL"/>
3947
<constraint firstItem="hU3-WF-wob" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="eaB-ag-fjR"/>
4048
<constraint firstAttribute="bottom" secondItem="hU3-WF-wob" secondAttribute="bottom" constant="16" id="gzT-9X-gMR"/>
4149
</constraints>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// XCUIElement+Expectations.swift
3+
// ReactiveDataDisplayManagerExampleUITests
4+
//
5+
// Created by Никита Коробейников on 19.12.2022.
6+
//
7+
8+
import XCTest
9+
10+
extension XCUIElement {
11+
12+
func waitForNonExistence(timeout: TimeInterval) -> Bool {
13+
let predicate = NSPredicate(format: "exists == false")
14+
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: self)
15+
16+
let result = XCTWaiter().wait(for: [expectation], timeout: timeout)
17+
18+
return result == .completed
19+
}
20+
21+
}

Example/ReactiveDataDisplayManagerExampleUITests/Plugins/DragAndDroppablePluginExampleUITest.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import XCTest
1010
final class DragAndDroppablePluginExampleUITest: BaseUITestCase {
1111

1212
private enum Constants {
13-
static let dragDuration = 0.3
14-
static let waitTime: UInt32 = 4
13+
static let dragDuration: TimeInterval = 1
14+
static let waitTime: UInt32 = UInt32(dragDuration)
1515
}
1616

1717
func testСollection_whenFirstCellDragingToDestination_thenDestinationCellBecomesFirst() throws {
@@ -25,7 +25,7 @@ final class DragAndDroppablePluginExampleUITest: BaseUITestCase {
2525

2626
let sourceCell = getCell(for: .collection, collectionId: collectionId, cellId: sourceDraggable)
2727
let destinationCell = getCell(for: .collection, collectionId: collectionId, cellId: destinationDraggable)
28-
sourceCell.press(forDuration: duration, thenDragTo: destinationCell, withVelocity: .slow, thenHoldForDuration: duration)
28+
sourceCell.press(forDuration: duration, thenDragTo: destinationCell)
2929

3030
sleep(Constants.waitTime)
3131
let firstCell = getFirstCell(for: .collection, id: collectionId)
@@ -44,10 +44,11 @@ final class DragAndDroppablePluginExampleUITest: BaseUITestCase {
4444

4545
let sourceCell = getCell(for: .table, collectionId: tableId, cellId: sourceDraggable)
4646
let destinationCell = getCell(for: .table, collectionId: tableId, cellId: destinationDraggable)
47-
sourceCell.press(forDuration: duration, thenDragTo: destinationCell, withVelocity: .slow, thenHoldForDuration: duration)
47+
sourceCell.press(forDuration: duration, thenDragTo: destinationCell)
4848

4949
sleep(Constants.waitTime)
5050
let firstCell = getFirstCell(for: .table, id: tableId)
51+
5152
XCTAssertTrue(firstCell.label == destinationDraggable)
5253
}
5354

Example/ReactiveDataDisplayManagerExampleUITests/Plugins/PaginatablePluginExampleUITest.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,34 @@ import XCTest
99

1010
final class PaginatablePluginExampleUITest: BaseUITestCase {
1111

12+
private enum Constants {
13+
static let timeout: TimeInterval = 3
14+
}
15+
1216
// Description: The first cell of the table is always the same
1317
func testTable_whenSwipeUp_thenCellsCountChanged() throws {
14-
let itemsInOnePage = 17
18+
let pageSize = 17
1519

1620
setTab("Table")
1721
tapTableElement("Table with pagination")
1822

19-
sleep(3)
2023
let table = app.tables.firstMatch
24+
XCTAssertTrue(table.waitForExistence(timeout: Constants.timeout))
2125

22-
while table.cells.count <= itemsInOnePage {
26+
while table.cells.count <= pageSize {
2327
table.swipeUp()
2428
}
2529

26-
let currentPage = table.cells.count / itemsInOnePage
27-
XCTAssertTrue(currentPage == 2)
30+
XCTAssertGreaterThan(table.cells.count, pageSize)
2831
}
2932

3033
// Description: In a collection, the first cell is the first visible cell
3134
func testCollection_whenSwipeUp_thenFirstVisibleCellChanged() throws {
3235
setTab("Collection")
3336
tapTableElement("Collection with pagination")
3437

35-
sleep(3)
3638
let collection = app.collectionViews.firstMatch
39+
XCTAssertTrue(collection.waitForExistence(timeout: Constants.timeout))
3740

3841
while collection.cells.firstMatch.label.contains("page 0") {
3942
collection.swipeUp()
@@ -49,8 +52,8 @@ final class PaginatablePluginExampleUITest: BaseUITestCase {
4952
setTab("Table")
5053
tapTableElement("Table with pagination")
5154

52-
sleep(4)
5355
let table = app.tables.firstMatch
56+
XCTAssertTrue(table.waitForExistence(timeout: Constants.timeout))
5457

5558
while !activityIndicator.isHittable {
5659
table.swipeUp()
@@ -65,8 +68,8 @@ final class PaginatablePluginExampleUITest: BaseUITestCase {
6568
setTab("Collection")
6669
tapTableElement("Collection with pagination")
6770

68-
sleep(4)
6971
let collection = app.collectionViews.firstMatch
72+
XCTAssertTrue(collection.waitForExistence(timeout: Constants.timeout))
7073

7174
while !activityIndicator.isHittable {
7275
collection.swipeUp()

Example/ReactiveDataDisplayManagerExampleUITests/Plugins/RefreshablePluginExampleUITest.swift

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,48 @@ import UIKit
1010

1111
final class RefreshablePluginExampleUITest: BaseUITestCase {
1212

13+
private enum Constants {
14+
static let dragDuration: TimeInterval = 0.5
15+
static let timeout: TimeInterval = 3
16+
}
17+
1318
func testTable_whenScrollDown_thenShowRefreshControl() throws {
1419
setTab("Table")
1520
tapTableElement("Table with refresh control")
1621

17-
let table = app.tables["Table_with_refresh_control"]
1822
let cell = getFirstCell(for: .table, id: "Table_with_refresh_control")
1923
let refreshControl = app.otherElements["RefreshableTableViewController_RefreshControl"]
2024

21-
let dragBegin = table.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0))
22-
let dragEnd = table.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
23-
dragBegin.press(forDuration: 0.1, thenDragTo: dragEnd)
25+
let start = cell.coordinate(withNormalizedOffset: .zero)
26+
let end = cell.coordinate(withNormalizedOffset: .init(dx: 0, dy: 6))
2427

25-
XCTAssertTrue(refreshControl.exists)
28+
start.press(forDuration: Constants.dragDuration,
29+
thenDragTo: end)
30+
31+
XCTAssertTrue(refreshControl.waitForExistence(timeout: Constants.timeout))
2632
XCTAssertTrue(cell.label == "Cell 1")
2733

28-
sleep(3)
29-
XCTAssertFalse(refreshControl.exists)
34+
XCTAssertTrue(refreshControl.waitForNonExistence(timeout: Constants.timeout))
3035
XCTAssertTrue(cell.label == "Refreshing 1")
3136
}
3237

3338
func testCollection_whenScrollDown_thenShowRefreshControl() throws {
3439
setTab("Collection")
3540
tapTableElement("Collection list with refreshing")
3641

37-
let collection = app.collectionViews["Refrashable_collection_list"]
3842
let cell = getFirstCell(for: .collection, id: "Refrashable_collection_list")
3943
let refreshControl = app.otherElements["RefreshableCollectionViewController_RefreshControl"]
4044

41-
let dragBegin = collection.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0))
42-
let dragEnd = collection.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
43-
dragBegin.press(forDuration: 0.1, thenDragTo: dragEnd)
45+
let start = cell.coordinate(withNormalizedOffset: .init(dx: 10, dy: 10))
46+
let end = cell.coordinate(withNormalizedOffset: .init(dx: 10, dy: 20))
47+
48+
start.press(forDuration: Constants.dragDuration,
49+
thenDragTo: end)
4450

45-
XCTAssertTrue(refreshControl.exists)
51+
XCTAssertTrue(refreshControl.waitForExistence(timeout: Constants.timeout))
4652
XCTAssertTrue(cell.label == "Item 1")
4753

48-
sleep(3)
49-
XCTAssertFalse(refreshControl.exists)
54+
XCTAssertTrue(refreshControl.waitForNonExistence(timeout: Constants.timeout))
5055
XCTAssertTrue(cell.label == "Refreshing 1")
5156
}
5257

Example/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
include:
33
- path: targets/template.yml
4-
relativePaths: false
4+
relativePaths: true
55

66

77
# Название проекта

0 commit comments

Comments
 (0)