Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a457cf6345 | |||
| 1e7bc4ef06 | |||
| 11a688de71 | |||
| f1c2b9065f | |||
| 203c0f1582 | |||
| bb5ce92196 | |||
| 8094e6a0fc | |||
| 349029fbc3 | |||
| 496ee1c177 | |||
| 444ad0cfaa | |||
| fe2027486b | |||
| f9cc696c83 | |||
| 7e96a251d7 | |||
| 8c9f02785d | |||
| bbe3a16e1a | |||
| 581b4f8d16 | |||
| 7917b9ecac | |||
| ad96fe29f9 | |||
| d0fa27e772 | |||
| 46460779e6 | |||
| d3e5bb4f2d | |||
| 7152ec831f | |||
| 74f554c2b9 | |||
| e132707c44 |
@@ -1 +1 @@
|
||||
github "ra1028/DifferenceKit" ~> 1.1
|
||||
github "ra1028/DifferenceKit" ~> 1.2
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
github "ra1028/DifferenceKit" "1.1.4"
|
||||
github "ra1028/DifferenceKit" "1.2.0"
|
||||
|
||||
Vendored
+1
-1
Submodule Carthage/Checkouts/DifferenceKit updated: bf0488b468...62745d7780
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'DiffableDataSources'
|
||||
spec.version = '0.3.0'
|
||||
spec.version = `cat .version`
|
||||
spec.author = { 'ra1028' => 'r.fe51028.r@gmail.com' }
|
||||
spec.homepage = 'https://github.com/ra1028/DiffableDataSources'
|
||||
spec.documentation_url = 'https://ra1028.github.io/DiffableDataSources'
|
||||
|
||||
@@ -49,7 +49,7 @@ final class MountainsViewController: NSViewController {
|
||||
.filter { $0.contains(filter) }
|
||||
.sorted { $0.name < $1.name }
|
||||
|
||||
let snapshot = DiffableDataSourceSnapshot<Section, Mountain>()
|
||||
var snapshot = DiffableDataSourceSnapshot<Section, Mountain>()
|
||||
snapshot.appendSections([.main])
|
||||
snapshot.appendItems(mountains)
|
||||
dataSource.apply(snapshot)
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ GEM
|
||||
sassc (~> 2.1)
|
||||
sqlite3 (~> 1.3)
|
||||
xcinvoke (~> 0.3.0)
|
||||
json (2.2.0)
|
||||
json (2.3.1)
|
||||
liferaft (0.0.6)
|
||||
minitest (5.13.0)
|
||||
molinillo (0.6.6)
|
||||
@@ -75,7 +75,7 @@ GEM
|
||||
nap (1.1.0)
|
||||
netrc (0.11.0)
|
||||
open4 (1.3.4)
|
||||
redcarpet (3.5.0)
|
||||
redcarpet (3.5.1)
|
||||
rouge (3.13.0)
|
||||
ruby-macho (1.4.0)
|
||||
sassc (2.2.1)
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@
|
||||
"repositoryURL": "https://github.com/ra1028/DifferenceKit.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "4eb31f8e85e4cb13732f9664d6e01e507cd592a0",
|
||||
"version": "1.1.3"
|
||||
"revision": "62745d7780deef4a023a792a1f8f763ec7bf9705",
|
||||
"version": "1.2.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ let package = Package(
|
||||
.library(name: "DiffableDataSources", targets: ["DiffableDataSources"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ra1028/DifferenceKit.git", .upToNextMinor(from: "1.1.0"))
|
||||
.package(url: "https://github.com/ra1028/DifferenceKit.git", .upToNextMinor(from: "1.2.0"))
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
|
||||
@@ -91,7 +91,7 @@ $ open DiffableDataSources.xcworkspace
|
||||
|
||||
First, define the type representing section.
|
||||
It should conforms to `Hashable` for identifies from the all sections.
|
||||
Type of enum can used conveniently befause it conforms `Hashable` by default.
|
||||
Type of enum can used conveniently because it conforms `Hashable` by default.
|
||||
|
||||
```swift
|
||||
enum Section {
|
||||
|
||||
@@ -35,7 +35,7 @@ struct SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
|
||||
self.init(id: id, items: [], isReloaded: false)
|
||||
}
|
||||
|
||||
init<C: Collection>(source: Section, elements: C) where C.Element == Item {
|
||||
init<C: Swift.Collection>(source: Section, elements: C) where C.Element == Item {
|
||||
self.init(id: source.differenceIdentifier, items: Array(elements), isReloaded: source.isReloaded)
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +132,29 @@ open class CollectionViewDiffableDataSource<SectionIdentifierType: Hashable, Ite
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
/// Returns whether it is possible to edit a row at given index path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - collectionView: A collection view instance managed by `self`.
|
||||
/// - section: An index of section.
|
||||
///
|
||||
/// - Returns: A boolean for row at specified index path.
|
||||
open func collectionView(_ collectionView: UICollectionView, canMoveItemAt indexPath: IndexPath) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
/// Moves a row at given index path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - collectionView: A collection view instance managed by `self`.
|
||||
/// - sourceIndexPath: An index path for given cell position.
|
||||
/// - destinationIndexPath: An index path for target cell position.
|
||||
///
|
||||
/// - Returns: Void.
|
||||
public func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
|
||||
// Empty implementation.
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -135,6 +135,74 @@ open class TableViewDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
/// Returns whether it is possible to edit a row at given index path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - tableView: A table view instance managed by `self`.
|
||||
/// - section: An index of section.
|
||||
///
|
||||
/// - Returns: A boolean for row at specified index path.
|
||||
open func tableView(_ tableView: UITableView, canEditRowAt: IndexPath) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
/// Returns whether it is possible to move a row at given index path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - tableView: A table view instance managed by `self`.
|
||||
/// - section: An index of section.
|
||||
///
|
||||
/// - Returns: A boolean for row at specified index path.
|
||||
open func tableView(_ tableView: UITableView, canMoveRowAt _: IndexPath) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
/// Performs the edit action for a row at given index path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - tableView: A table view instance managed by `self`.
|
||||
/// - editingStyle: An action for given edit action.
|
||||
/// - indexPath: An index path for cell.
|
||||
///
|
||||
/// - Returns: Void.
|
||||
open func tableView(_ tableView: UITableView, commit _: UITableViewCell.EditingStyle, forRowAt _: IndexPath) {
|
||||
// Empty implementation.
|
||||
}
|
||||
|
||||
/// Moves a row at given index path.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - tableView: A table view instance managed by `self`.
|
||||
/// - source: An index path for given cell position.
|
||||
/// - target: An index path for target cell position.
|
||||
///
|
||||
/// - Returns: Void.
|
||||
open func tableView(_ tableView: UITableView, moveRowAt _: IndexPath, to _: IndexPath) {
|
||||
// Empty implementation.
|
||||
}
|
||||
|
||||
/// Return list of section titles to display in section index view (e.g. "ABCD...Z#").
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - tableView: A table view instance managed by `self`.
|
||||
///
|
||||
/// - Returns: The list of section titles to display.
|
||||
open func sectionIndexTitles(for tableView: UITableView) -> [String]? {
|
||||
return nil
|
||||
}
|
||||
|
||||
/// Tell table which section corresponds to section title/index (e.g. "B",1)).
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - tableView: A table view instance managed by `self`.
|
||||
/// - title: The title as displayed in the section index of tableView.
|
||||
/// - section: An index number identifying a section title in the array returned by sectionIndexTitles(for tableView:).
|
||||
///
|
||||
/// - Returns: The list of section titles to display.
|
||||
open func tableView(_ tableView: UITableView, sectionForSectionIndexTitle _: String, at section: Int) -> Int {
|
||||
return section
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -167,6 +167,24 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
|
||||
cell
|
||||
)
|
||||
}
|
||||
|
||||
func testCanMoveRowAt() {
|
||||
let collectionView = MockCollectionView()
|
||||
let cell = UICollectionViewCell()
|
||||
let dataSource = CollectionViewDiffableDataSource<Int, Int>(collectionView: collectionView) { _, _, _ in
|
||||
cell
|
||||
}
|
||||
|
||||
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
|
||||
snapshot.appendSections([0, 1, 2])
|
||||
snapshot.appendItems([0, 1, 2], toSection: 0)
|
||||
dataSource.apply(snapshot)
|
||||
|
||||
XCTAssertEqual(
|
||||
dataSource.collectionView(collectionView, canMoveItemAt: IndexPath(item: 1, section: 0)),
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
final class MockCollectionView: UICollectionView {
|
||||
|
||||
@@ -167,6 +167,42 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
|
||||
cell
|
||||
)
|
||||
}
|
||||
|
||||
func testCanEditRowAt() {
|
||||
let tableView = MockTableView()
|
||||
let cell = UITableViewCell()
|
||||
let dataSource = TableViewDiffableDataSource<Int, Int>(tableView: tableView) { _, _, _ in
|
||||
cell
|
||||
}
|
||||
|
||||
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
|
||||
snapshot.appendSections([0, 1, 2])
|
||||
snapshot.appendItems([0, 1, 2], toSection: 0)
|
||||
dataSource.apply(snapshot)
|
||||
|
||||
XCTAssertEqual(
|
||||
dataSource.tableView(tableView, canEditRowAt: IndexPath(item: 1, section: 0)),
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
func testCanMoveRowAt() {
|
||||
let tableView = MockTableView()
|
||||
let cell = UITableViewCell()
|
||||
let dataSource = TableViewDiffableDataSource<Int, Int>(tableView: tableView) { _, _, _ in
|
||||
cell
|
||||
}
|
||||
|
||||
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
|
||||
snapshot.appendSections([0, 1, 2])
|
||||
snapshot.appendItems([0, 1, 2], toSection: 0)
|
||||
dataSource.apply(snapshot)
|
||||
|
||||
XCTAssertEqual(
|
||||
dataSource.tableView(tableView, canMoveRowAt: IndexPath(item: 1, section: 0)),
|
||||
false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
final class MockTableView: UITableView {
|
||||
|
||||
@@ -5,11 +5,11 @@ TVOS_DEPLOYMENT_TARGET = 9.0
|
||||
SDKROOT =
|
||||
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator
|
||||
TARGETED_DEVICE_FAMILY = 1,2,3
|
||||
VALID_ARCHS[sdk=macosx*] = i386 x86_64
|
||||
VALID_ARCHS[sdk=macosx*] = arm64 i386 x86_64
|
||||
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
|
||||
VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64
|
||||
VALID_ARCHS[sdk=iphonesimulator*] = arm64 i386 x86_64
|
||||
VALID_ARCHS[sdk=appletv*] = arm64
|
||||
VALID_ARCHS[sdk=appletvsimulator*] = x86_64
|
||||
VALID_ARCHS[sdk=appletvsimulator*] = arm64 x86_64
|
||||
|
||||
CODE_SIGN_IDENTITY =
|
||||
CODE_SIGN_STYLE = Manual
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="../index.html">
|
||||
DiffableDataSources Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
(98% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -167,7 +167,7 @@ changes with automatic diffing.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">supplementaryViewProvider</span><span class="p">:</span> <span class="kt">CollectionViewDiffableDataSource</span><span class="o"><</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">>.</span><span class="kt"><a href="../Classes/CollectionViewDiffableDataSource.html#/s:19DiffableDataSources014CollectionViewaB6SourceC013SupplementaryE8Providera">SupplementaryViewProvider</a></span><span class="p">?</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">supplementaryViewProvider</span><span class="p">:</span> <span class="kt"><a href="../Classes/CollectionViewDiffableDataSource.html#/s:19DiffableDataSources014CollectionViewaB6SourceC013SupplementaryE8Providera">SupplementaryViewProvider</a></span><span class="p">?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -683,6 +683,142 @@ changes with automatic diffing.</p>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources014CollectionViewaB6SourceC010collectionE0_13canMoveItemAtSbSo012UICollectionE0C_10Foundation9IndexPathVtF"></a>
|
||||
<a name="//apple_ref/swift/Method/collectionView(_:canMoveItemAt:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources014CollectionViewaB6SourceC010collectionE0_13canMoveItemAtSbSo012UICollectionE0C_10Foundation9IndexPathVtF">collectionView(_:canMoveItemAt:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Returns whether it is possible to edit a row at given index path.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="n">_</span> <span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">canMoveItemAt</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>collectionView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A collection view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>section</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index of section.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>A boolean for row at specified index path.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources014CollectionViewaB6SourceC010collectionE0_10moveItemAt2toySo012UICollectionE0C_10Foundation9IndexPathVAKtF"></a>
|
||||
<a name="//apple_ref/swift/Method/collectionView(_:moveItemAt:to:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources014CollectionViewaB6SourceC010collectionE0_10moveItemAt2toySo012UICollectionE0C_10Foundation9IndexPathVAKtF">collectionView(_:moveItemAt:to:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Moves a row at given index path.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="n">_</span> <span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">moveItemAt</span> <span class="nv">sourceIndexPath</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">,</span> <span class="n">to</span> <span class="nv">destinationIndexPath</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>collectionView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A collection view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>sourceIndexPath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index path for given cell position.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>destinationIndexPath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index path for target cell position.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>Void.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -691,7 +827,7 @@ changes with automatic diffing.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-12-10)</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2021-06-09)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="../index.html">
|
||||
DiffableDataSources Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
(98% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -706,6 +706,402 @@ changes with automatic diffing.</p>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_12canEditRowAtSbSo07UITableE0C_10Foundation9IndexPathVtF"></a>
|
||||
<a name="//apple_ref/swift/Method/tableView(_:canEditRowAt:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_12canEditRowAtSbSo07UITableE0C_10Foundation9IndexPathVtF">tableView(_:canEditRowAt:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Returns whether it is possible to edit a row at given index path.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">tableView</span><span class="p">(</span><span class="n">_</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">,</span> <span class="nv">canEditRowAt</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tableView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A table view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>section</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index of section.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>A boolean for row at specified index path.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_12canMoveRowAtSbSo07UITableE0C_10Foundation9IndexPathVtF"></a>
|
||||
<a name="//apple_ref/swift/Method/tableView(_:canMoveRowAt:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_12canMoveRowAtSbSo07UITableE0C_10Foundation9IndexPathVtF">tableView(_:canMoveRowAt:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Returns whether it is possible to move a row at given index path.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">tableView</span><span class="p">(</span><span class="n">_</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">,</span> <span class="n">canMoveRowAt</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tableView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A table view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>section</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index of section.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>A boolean for row at specified index path.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_6commit8forRowAtySo07UITableE0C_So0lE16CellEditingStyleV10Foundation9IndexPathVtF"></a>
|
||||
<a name="//apple_ref/swift/Method/tableView(_:commit:forRowAt:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_6commit8forRowAtySo07UITableE0C_So0lE16CellEditingStyleV10Foundation9IndexPathVtF">tableView(_:commit:forRowAt:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Performs the edit action for a row at given index path.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">tableView</span><span class="p">(</span><span class="n">_</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">,</span> <span class="n">commit</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">UITableViewCell</span><span class="o">.</span><span class="kt">EditingStyle</span><span class="p">,</span> <span class="n">forRowAt</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tableView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A table view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>editingStyle</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An action for given edit action.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>indexPath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index path for cell.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>Void.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_9moveRowAt2toySo07UITableE0C_10Foundation9IndexPathVAKtF"></a>
|
||||
<a name="//apple_ref/swift/Method/tableView(_:moveRowAt:to:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_9moveRowAt2toySo07UITableE0C_10Foundation9IndexPathVAKtF">tableView(_:moveRowAt:to:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Moves a row at given index path.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">tableView</span><span class="p">(</span><span class="n">_</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">,</span> <span class="n">moveRowAt</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">,</span> <span class="n">to</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">IndexPath</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tableView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A table view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>source</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index path for given cell position.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>target</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index path for target cell position.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>Void.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources09TableViewaB6SourceC18sectionIndexTitles3forSaySSGSgSo07UITableE0C_tF"></a>
|
||||
<a name="//apple_ref/swift/Method/sectionIndexTitles(for:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC18sectionIndexTitles3forSaySSGSgSo07UITableE0C_tF">sectionIndexTitles(for:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Return list of section titles to display in section index view (e.g. <q>ABCD…Z#</q>).</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">sectionIndexTitles</span><span class="p">(</span><span class="k">for</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">)</span> <span class="o">-></span> <span class="p">[</span><span class="kt">String</span><span class="p">]?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tableView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A table view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>The list of section titles to display.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_27sectionForSectionIndexTitle2atSiSo07UITableE0C_SSSitF"></a>
|
||||
<a name="//apple_ref/swift/Method/tableView(_:sectionForSectionIndexTitle:at:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_27sectionForSectionIndexTitle2atSiSo07UITableE0C_SSSitF">tableView(_:sectionForSectionIndexTitle:at:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Tell table which section corresponds to section title/index (e.g. <q>B</q>,1)).</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">tableView</span><span class="p">(</span><span class="n">_</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">UITableView</span><span class="p">,</span> <span class="n">sectionForSectionIndexTitle</span> <span class="nv">_</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">at</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Int</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tableView</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>A table view instance managed by <code>self</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>title</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The title as displayed in the section index of tableView.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>section</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>An index number identifying a section title in the array returned by sectionIndexTitles(for tableView:).</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Return Value</h4>
|
||||
<p>The list of section titles to display.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -714,7 +1110,7 @@ changes with automatic diffing.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-12-10)</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2021-06-09)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="index.html">
|
||||
DiffableDataSources Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
(98% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -156,7 +156,7 @@ changes with automatic diffing.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-12-10)</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2021-06-09)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="index.html">
|
||||
DiffableDataSources Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
(98% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -121,7 +121,7 @@ Represents the mutable state of diffable data source of UI.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-12-10)</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2021-06-09)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<a class="header-link" href="../index.html">
|
||||
DiffableDataSources Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
(98% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -1264,7 +1264,7 @@ Represents the mutable state of diffable data source of UI.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-12-10)</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2021-06-09)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
+8
-8
@@ -1,15 +1,15 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="20">
|
||||
<linearGradient id="b" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="a">
|
||||
<rect width="136" height="20" rx="3" fill="#fff"/>
|
||||
<rect width="128" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="#555" d="M0 0h93v20H0z"/>
|
||||
<path fill="#4c1" d="M93 0h43v20H93z"/>
|
||||
<path fill="url(#b)" d="M0 0h136v20H0z"/>
|
||||
<path fill="#4c1" d="M93 0h35v20H93z"/>
|
||||
<path fill="url(#b)" d="M0 0h128v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
|
||||
@@ -18,11 +18,11 @@
|
||||
<text x="475" y="140" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
<text x="1095" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">
|
||||
98%
|
||||
</text>
|
||||
<text x="1135" y="140" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
<text x="1095" y="140" transform="scale(.1)" textLength="250">
|
||||
98%
|
||||
</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
+3
-3
@@ -22,7 +22,7 @@
|
||||
<a class="header-link" href="index.html">
|
||||
DiffableDataSources Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
(98% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
@@ -176,7 +176,7 @@ Correspondence table is below. </p>
|
||||
|
||||
<p>First, define the type representing section.<br>
|
||||
It should conforms to <code>Hashable</code> for identifies from the all sections.<br>
|
||||
Type of enum can used conveniently befause it conforms <code>Hashable</code> by default. </p>
|
||||
Type of enum can used conveniently because it conforms <code>Hashable</code> by default. </p>
|
||||
<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Section</span> <span class="p">{</span>
|
||||
<span class="k">case</span> <span class="n">main</span>
|
||||
<span class="p">}</span>
|
||||
@@ -287,7 +287,7 @@ Please see the <a href="https://github.com/ra1028/DiffableDataSources/blob/maste
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-12-10)</p>
|
||||
<p>© 2021 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2021-06-09)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.11.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user