47 Commits

Author SHA1 Message Date
Ryo Aoyama a457cf6345 Merge pull request #38 from ra1028/v0.5.0
Bump version to 0.5.0
2021-06-09 00:25:33 +09:00
Ryo Aoyama 1e7bc4ef06 Update docs 2021-06-09 00:18:07 +09:00
Ryo Aoyama 11a688de71 Update .version 2021-06-09 00:15:30 +09:00
Ryo Aoyama f1c2b9065f Merge pull request #29 from jdanthinne/master
Add missing sectionIndexTitles method for tableviews
2021-06-09 00:11:09 +09:00
Ryo Aoyama 203c0f1582 Merge pull request #27 from sidepelican/patch-1
Fix compile error of sample mac application
2021-06-09 00:09:06 +09:00
Ryo Aoyama bb5ce92196 Merge pull request #30 from fossil12/patch-1
Fix typo
2021-06-09 00:08:36 +09:00
Ryo Aoyama 8094e6a0fc Merge pull request #35 from ra1028/dependabot/bundler/redcarpet-3.5.1
Bump redcarpet from 3.5.0 to 3.5.1
2021-06-09 00:08:17 +09:00
Ryo Aoyama 349029fbc3 Merge pull request #25 from ra1028/dependabot/bundler/json-2.3.1
Bump json from 2.2.0 to 2.3.1
2021-06-09 00:08:05 +09:00
Ryo Aoyama 496ee1c177 Merge pull request #37 from vincentisambart/arm64-mac
Support for ARM64 Macs
2021-06-09 00:03:59 +09:00
Vincent Isambart 444ad0cfaa Support for ARM64 Macs 2021-05-20 15:23:42 +09:00
dependabot[bot] fe2027486b Bump redcarpet from 3.5.0 to 3.5.1
Bumps [redcarpet](https://github.com/vmg/redcarpet) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/vmg/redcarpet/releases)
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vmg/redcarpet/compare/v3.5.0...v3.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-11 19:45:47 +00:00
David Keller f9cc696c83 Fix typo 2020-09-07 20:15:52 +02:00
Jérôme Danthinne 7e96a251d7 Add missing sectionIndexTitles method for tableviews 2020-08-18 14:06:55 +02:00
Iceman 8c9f02785d Fix compile error of sample mac application 2020-08-02 22:48:06 +09:00
dependabot[bot] bbe3a16e1a Bump json from 2.2.0 to 2.3.1
Bumps [json](https://github.com/flori/json) from 2.2.0 to 2.3.1.
- [Release notes](https://github.com/flori/json/releases)
- [Changelog](https://github.com/flori/json/blob/master/CHANGES.md)
- [Commits](https://github.com/flori/json/compare/v2.2.0...v2.3.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 04:58:11 +00:00
Ryo Aoyama 581b4f8d16 Merge pull request #23 from ra1028/v0.4.0
Bump version to 0.4.0
2020-04-12 09:08:41 +09:00
Ryo Aoyama 7917b9ecac Bump version to 0.4.0 2020-04-12 08:44:25 +09:00
Ryo Aoyama ad96fe29f9 Merge pull request #22 from bobek-balinek/feature/missing-data-source-methods
Add default implementation for other UITableViewDelegate/UICollectionViewDelegate methods
2020-04-12 08:26:52 +09:00
Bobby Bobak d0fa27e772 Merge branch 'master' into feature/missing-data-source-methods 2020-04-07 15:13:22 +01:00
Bobby Bobak 46460779e6 Add tests for newly added methods and update the implementation of the CollectionViewDiffableDataSource with canMove/moveItemAt methods 2020-04-07 10:11:42 +01:00
Ryo Aoyama d3e5bb4f2d Merge pull request #20 from bitsfabrik/master
Compiler Error Swift.Collection required
2020-04-01 00:14:04 +09:00
Bobby Bobak 7152ec831f Possible fix for the build error 2020-03-26 19:50:29 +00:00
BiNo 74f554c2b9 add Swift.Collection 2020-03-25 15:37:35 +01:00
Bobby Bobak e132707c44 Add all of the remaining UITableViewDataSource methods to the TableViewDiffableDataSource 2020-01-15 14:27:17 +00:00
Ryo Aoyama 1d6674cf60 Merge pull request #12 from ra1028/completion-block
Add completion block
2019-12-10 16:36:38 +09:00
Ryo Aoyama 0fb3bbd7ae Add test environment xcode 11.2.1 on CI 2019-12-10 16:07:10 +09:00
Ryo Aoyama 240e52b500 Update docs 2019-12-10 15:39:46 +09:00
Ryo Aoyama b87be70ffc Update podspec 2019-12-10 15:37:05 +09:00
Ryo Aoyama 3505c43a46 Update README 2019-12-10 15:32:56 +09:00
Ryo Aoyama 8df43ab0b4 Update gems 2019-12-10 15:31:49 +09:00
Ryo Aoyama 8db42c2188 Add tests 2019-12-10 15:26:30 +09:00
Ryo Aoyama b581a3e266 Add completion block to apply function 2019-12-10 15:08:33 +09:00
Ryo Aoyama 36dd382b99 Merge pull request #11 from ShapeGames/master
Updates git submodule.
2019-12-10 14:11:00 +09:00
Daniel Molina 6f5fa6dc1a Fixes compile errors. 2019-12-09 16:38:29 +01:00
Daniel Molina 544d9855ac Updates git submodule. 2019-12-09 16:29:38 +01:00
Ryo Aoyama 46e6b7b339 Merge pull request #6 from simba909/master
Add support for specifying section header and footer titles
2019-09-17 21:06:06 +09:00
Ryo Aoyama fc4aeb58e6 Merge pull request #7 from AYastrebov/master
Update Podspec sources to different platforms
2019-09-17 21:05:15 +09:00
Andrey Yastrebov dce290aea3 update podspec 2019-09-17 14:16:26 +03:00
Simon Jarbrant 981a3c57d8 Add support for specifying section header and footer titles through TableViewDiffableDataSource subclasses 2019-09-08 16:59:12 +02:00
Ryo Aoyama 328894d8da Merge pull request #5 from ra1028/v0.2.0
v0.2.0
2019-09-03 00:01:53 +09:00
Ryo Aoyama 715e0692c4 Update docs 2019-09-02 23:53:26 +09:00
Ryo Aoyama cb3ab8fb41 Update podspec 2019-09-02 23:45:33 +09:00
Ryo Aoyama 72c639ebe7 Fix syntax 2019-09-02 23:42:49 +09:00
Ryo Aoyama 8bd94b65b1 Merge pull request #4 from kishikawakatsumi/typo
Fix typo
2019-09-02 23:40:32 +09:00
Ryo Aoyama ea762adc00 Merge pull request #3 from kishikawakatsumi/class-to-struct
Make `DiffableDataSourceSnapshot` struct
2019-09-02 23:39:27 +09:00
Kishikawa Katsumi d717904e46 Make DiffableDataSourceSnapshot struct
In the latest Xcode 11 (beta 6), DiffableDataSourceSnapshot class changed to a struct.
This PR adopt the API to the latest UIKit's API.
2019-08-26 02:28:25 +09:00
Kishikawa Katsumi dbbea25eac Fix typo 2019-08-25 18:48:26 +09:00
40 changed files with 1512 additions and 439 deletions
+1
View File
@@ -0,0 +1 @@
0.5.0
+1 -1
View File
@@ -1 +1 @@
github "ra1028/DifferenceKit" ~> 1.1
github "ra1028/DifferenceKit" ~> 1.2
+1 -1
View File
@@ -1 +1 @@
github "ra1028/DifferenceKit" "1.1.3"
github "ra1028/DifferenceKit" "1.2.0"
+11 -7
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'DiffableDataSources'
spec.version = '0.1.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'
@@ -8,7 +8,6 @@ Pod::Spec.new do |spec|
spec.source = { :git => 'https://github.com/ra1028/DiffableDataSources.git', :tag => spec.version.to_s }
spec.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
spec.requires_arc = true
spec.source_files = 'Sources/**/*.swift'
spec.swift_versions = ["5.0", "5.1"]
differenekit_version = '~> 1.1'
@@ -17,11 +16,16 @@ Pod::Spec.new do |spec|
spec.tvos.dependency 'DifferenceKit/UIKitExtension', differenekit_version
spec.osx.dependency 'DifferenceKit/AppKitExtension', differenekit_version
spec.ios.frameworks = 'UIKit'
spec.tvos.frameworks = 'UIKit'
spec.osx.frameworks = 'Appkit'
spec.source_files = 'Sources/Internal/*.swift', 'Sources/*.swift'
spec.ios.source_files = 'Sources/UIKit/*.swift'
spec.tvos.source_files = 'Sources/UIKit/*.swift'
spec.osx.source_files = 'Sources/AppKit/*.swift'
spec.ios.deployment_target = '9.0'
spec.ios.frameworks = 'UIKit'
spec.tvos.frameworks = 'UIKit'
spec.osx.frameworks = 'Appkit'
spec.ios.deployment_target = '9.0'
spec.tvos.deployment_target = '9.0'
spec.osx.deployment_target = '10.11'
spec.osx.deployment_target = '10.11'
end
@@ -107,7 +107,7 @@ final class InsertionSortViewController: UIViewController {
}
func randmize(animated: Bool) {
let snapshot = DiffableDataSourceSnapshot<Section, Node>()
var snapshot = DiffableDataSourceSnapshot<Section, Node>()
let rows = Int(collectionView.bounds.height / nodeSize.height) - 1
let columns = Int(collectionView.bounds.width / nodeSize.width)
@@ -126,7 +126,7 @@ final class InsertionSortViewController: UIViewController {
}
var isNextSortRequired = false
let snapshot = dataSource.snapshot()
var snapshot = dataSource.snapshot()
for section in snapshot.sectionIdentifiers where !section.isSorted {
section.sortNext()
@@ -50,7 +50,7 @@ final class MountainsViewController: UIViewController {
.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)
+1 -1
View File
@@ -42,7 +42,7 @@ final class TopViewController: UIViewController {
}
func reset() {
let snapshot = DiffableDataSourceSnapshot<Section, Item>()
var snapshot = DiffableDataSourceSnapshot<Section, Item>()
snapshot.appendSections([.main])
snapshot.appendItems([.mountains, .insertionSort])
dataSource.apply(snapshot)
@@ -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
View File
@@ -1,4 +1,4 @@
source "https://rubygems.org"
gem 'cocoapods', '1.7.2'
gem 'jazzy', '0.9.4'
gem 'cocoapods', '1.8.4'
gem 'jazzy', '0.11.2'
+33 -32
View File
@@ -1,24 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
CFPropertyList (3.0.2)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
algoliasearch (1.27.1)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.7.2)
claide (1.0.3)
cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.7.2)
cocoapods-core (= 1.8.4)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
@@ -27,65 +30,63 @@ GEM
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.10.0, < 2.0)
cocoapods-core (1.7.2)
xcodeproj (>= 1.11.1, < 2.0)
cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-trunk (1.4.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
escape (0.0.4)
ffi (1.11.1)
fourflusher (2.3.0)
ffi (1.11.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jazzy (0.9.4)
cocoapods (~> 1.0)
mustache (~> 0.99)
jazzy (0.11.2)
cocoapods (~> 1.5)
mustache (~> 1.1)
open4
redcarpet (~> 3.2)
redcarpet (~> 3.4)
rouge (>= 2.0.6, < 4.0)
sass (~> 3.4)
sassc (~> 2.1)
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
json (2.3.1)
liferaft (0.0.6)
minitest (5.11.3)
minitest (5.13.0)
molinillo (0.6.6)
mustache (0.99.8)
mustache (1.1.1)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
open4 (1.3.4)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redcarpet (3.4.0)
rouge (3.4.1)
redcarpet (3.5.1)
rouge (3.13.0)
ruby-macho (1.4.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.2.1)
ffi (~> 1.9)
sqlite3 (1.4.1)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcinvoke (0.3.0)
liferaft (~> 0.0.6)
xcodeproj (1.10.0)
xcodeproj (1.13.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
@@ -96,8 +97,8 @@ PLATFORMS
ruby
DEPENDENCIES
cocoapods (= 1.7.2)
jazzy (= 0.9.4)
cocoapods (= 1.8.4)
jazzy (= 0.11.2)
BUNDLED WITH
2.0.1
2.0.2
+2 -2
View File
@@ -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
View File
@@ -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(
+4 -2
View File
@@ -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 {
@@ -144,7 +144,9 @@ let snapshot = DiffableDataSourceSnapshot<Section, User>()
snapshot.appendSections([.main])
snapshot.appendItems(users)
dataSource.apply(snapshot)
dataSource.apply(snapshot) {
// completion
}
```
Check the documentation for more detailed API.
@@ -33,14 +33,18 @@ open class CocoaCollectionViewDiffableDataSource<SectionIdentifierType: Hashable
/// - snapshot: A snapshot object to be applied to data model.
/// - animatingDifferences: A Boolean value indicating whether to update with
/// diffing animation.
public func apply(_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>, animatingDifferences: Bool = true) {
/// - completion: An optional completion block which is called when the complete
/// performing updates.
public func apply(_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>, animatingDifferences: Bool = true, completion: (() -> Void)? = nil) {
core.apply(
snapshot,
view: collectionView,
animatingDifferences: animatingDifferences,
performUpdates: { collectionView, changeset, setSections in
collectionView.reload(using: changeset, setData: setSections)
})
},
completion: completion
)
}
/// Returns a new snapshot object of current state.
+17 -17
View File
@@ -1,7 +1,7 @@
/// A class for backporting `NSDiffableDataSourceSnapshot` introduced in iOS 13.0+, macOS 10.15+, tvOS 13.0+.
/// Represents the mutable state of diffable data source of UI.
public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIdentifierType: Hashable> {
internal let structure = SnapshotStructure<SectionIdentifierType, ItemIdentifierType>()
public struct DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIdentifierType: Hashable> {
internal var structure = SnapshotStructure<SectionIdentifierType, ItemIdentifierType>()
/// Creates a new empty snapshot object.
public init() {}
@@ -81,7 +81,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifiers: The item identifiers to be appended.
/// - sectionIdentifier: An identifier of section to append the given identiciers.
public func appendItems(_ identifiers: [ItemIdentifierType], toSection sectionIdentifier: SectionIdentifierType? = nil) {
public mutating func appendItems(_ identifiers: [ItemIdentifierType], toSection sectionIdentifier: SectionIdentifierType? = nil) {
structure.append(itemIDs: identifiers, to: sectionIdentifier)
}
@@ -90,7 +90,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifiers: The item identifiers to be inserted.
/// - beforeIdentifier: An identifier of item.
public func insertItems(_ identifiers: [ItemIdentifierType], beforeItem beforeIdentifier: ItemIdentifierType) {
public mutating func insertItems(_ identifiers: [ItemIdentifierType], beforeItem beforeIdentifier: ItemIdentifierType) {
structure.insert(itemIDs: identifiers, before: beforeIdentifier)
}
@@ -99,7 +99,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifiers: The item identifiers to be inserted.
/// - afterIdentifier: An identifier of item.
public func insertItems(_ identifiers: [ItemIdentifierType], afterItem afterIdentifier: ItemIdentifierType) {
public mutating func insertItems(_ identifiers: [ItemIdentifierType], afterItem afterIdentifier: ItemIdentifierType) {
structure.insert(itemIDs: identifiers, after: afterIdentifier)
}
@@ -107,12 +107,12 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
///
/// - Parameters:
/// - identifiers: The item identifiers to be deleted.
public func deleteItems(_ identifiers: [ItemIdentifierType]) {
public mutating func deleteItems(_ identifiers: [ItemIdentifierType]) {
structure.remove(itemIDs: identifiers)
}
/// Deletes the all items in the snapshot.
public func deleteAllItems() {
public mutating func deleteAllItems() {
structure.removeAllItems()
}
@@ -121,7 +121,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifier: An item identifier to be moved.
/// - toIdentifier: An identifier of item.
public func moveItem(_ identifier: ItemIdentifierType, beforeItem toIdentifier: ItemIdentifierType) {
public mutating func moveItem(_ identifier: ItemIdentifierType, beforeItem toIdentifier: ItemIdentifierType) {
structure.move(itemID: identifier, before: toIdentifier)
}
@@ -130,7 +130,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifier: An item identifier to be moved.
/// - toIdentifier: An identifier of item.
public func moveItem(_ identifier: ItemIdentifierType, afterItem toIdentifier: ItemIdentifierType) {
public mutating func moveItem(_ identifier: ItemIdentifierType, afterItem toIdentifier: ItemIdentifierType) {
structure.move(itemID: identifier, after: toIdentifier)
}
@@ -138,7 +138,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
///
/// - Parameters:
/// - identifiers: The item identifiers to be reloaded.
public func reloadItems(_ identifiers: [ItemIdentifierType]) {
public mutating func reloadItems(_ identifiers: [ItemIdentifierType]) {
structure.update(itemIDs: identifiers)
}
@@ -146,7 +146,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
///
/// - Parameters:
/// - identifiers: The section identifiers to be appended.
public func appendSections(_ identifiers: [SectionIdentifierType]) {
public mutating func appendSections(_ identifiers: [SectionIdentifierType]) {
structure.append(sectionIDs: identifiers)
}
@@ -155,7 +155,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifiers: The section identifiers to be inserted.
/// - toIdentifier: An identifier of setion.
public func insertSections(_ identifiers: [SectionIdentifierType], beforeSection toIdentifier: SectionIdentifierType) {
public mutating func insertSections(_ identifiers: [SectionIdentifierType], beforeSection toIdentifier: SectionIdentifierType) {
structure.insert(sectionIDs: identifiers, before: toIdentifier)
}
@@ -164,7 +164,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifiers: The section identifiers to be inserted.
/// - toIdentifier: An identifier of setion.
public func insertSections(_ identifiers: [SectionIdentifierType], afterSection toIdentifier: SectionIdentifierType) {
public mutating func insertSections(_ identifiers: [SectionIdentifierType], afterSection toIdentifier: SectionIdentifierType) {
structure.insert(sectionIDs: identifiers, after: toIdentifier)
}
@@ -172,7 +172,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
///
/// - Parameters:
/// - identifiers: The section identifiers to be deleted.
public func deleteSections(_ identifiers: [SectionIdentifierType]) {
public mutating func deleteSections(_ identifiers: [SectionIdentifierType]) {
structure.remove(sectionIDs: identifiers)
}
@@ -181,7 +181,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifier: A section identifier to be moved.
/// - toIdentifier: An identifier of section.
public func moveSection(_ identifier: SectionIdentifierType, beforeSection toIdentifier: SectionIdentifierType) {
public mutating func moveSection(_ identifier: SectionIdentifierType, beforeSection toIdentifier: SectionIdentifierType) {
structure.move(sectionID: identifier, before: toIdentifier)
}
@@ -190,7 +190,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
/// - Parameters:
/// - identifier: A section identifier to be moved.
/// - toIdentifier: An identifier of section.
public func moveSection(_ identifier: SectionIdentifierType, afterSection toIdentifier: SectionIdentifierType) {
public mutating func moveSection(_ identifier: SectionIdentifierType, afterSection toIdentifier: SectionIdentifierType) {
structure.move(sectionID: identifier, after: toIdentifier)
}
@@ -198,7 +198,7 @@ public class DiffableDataSourceSnapshot<SectionIdentifierType: Hashable, ItemIde
///
/// - Parameters:
/// - identifiers: The section identifiers to be reloaded.
public func reloadSections(_ identifiers: [SectionIdentifierType]) {
public mutating func reloadSections(_ identifiers: [SectionIdentifierType]) {
structure.update(sectionIDs: identifiers)
}
}
@@ -13,7 +13,8 @@ final class DiffableDataSourceCore<SectionIdentifierType: Hashable, ItemIdentifi
_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
view: View?,
animatingDifferences: Bool,
performUpdates: @escaping (View, StagedChangeset<[Section]>, @escaping ([Section]) -> Void) -> Void
performUpdates: @escaping (View, StagedChangeset<[Section]>, @escaping ([Section]) -> Void) -> Void,
completion: (() -> Void)?
) {
dispatcher.dispatch { [weak self] in
guard let self = self else {
@@ -35,20 +36,23 @@ final class DiffableDataSourceCore<SectionIdentifierType: Hashable, ItemIdentifi
}
}
CATransaction.begin()
CATransaction.setCompletionBlock(completion)
if animatingDifferences {
performDiffingUpdates()
}
else {
CATransaction.begin()
CATransaction.setDisableActions(true)
performDiffingUpdates()
CATransaction.commit()
}
CATransaction.commit()
}
}
func snapshot() -> DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType> {
let snapshot = DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>()
var snapshot = DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>()
snapshot.structure.sections = currentSnapshot.structure.sections
return snapshot
}
+19 -19
View File
@@ -1,7 +1,7 @@
import Foundation
import DifferenceKit
final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
struct SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
struct Item: Differentiable, Equatable {
var differenceIdentifier: ItemID
var isReloaded: Bool
@@ -35,7 +35,7 @@ final class 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)
}
@@ -68,7 +68,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
return itemPositionMap()[itemID]?.section.differenceIdentifier
}
func append(itemIDs: [ItemID], to sectionID: SectionID? = nil, file: StaticString = #file, line: UInt = #line) {
mutating func append(itemIDs: [ItemID], to sectionID: SectionID? = nil, file: StaticString = #file, line: UInt = #line) {
let index: Array<Section>.Index
if let sectionID = sectionID {
@@ -90,7 +90,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections[index].elements.append(contentsOf: items)
}
func insert(itemIDs: [ItemID], before beforeItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
mutating func insert(itemIDs: [ItemID], before beforeItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
guard let itemPosition = itemPositionMap()[beforeItemID] else {
specifiedItemIsNotFound(beforeItemID, file: file, line: line)
}
@@ -99,7 +99,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections[itemPosition.sectionIndex].elements.insert(contentsOf: items, at: itemPosition.itemRelativeIndex)
}
func insert(itemIDs: [ItemID], after afterItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
mutating func insert(itemIDs: [ItemID], after afterItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
guard let itemPosition = itemPositionMap()[afterItemID] else {
specifiedItemIsNotFound(afterItemID, file: file, line: line)
}
@@ -109,7 +109,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections[itemPosition.sectionIndex].elements.insert(contentsOf: items, at: itemIndex)
}
func remove(itemIDs: [ItemID]) {
mutating func remove(itemIDs: [ItemID]) {
let itemPositionMap = self.itemPositionMap()
var removeIndexSetMap = [Int: IndexSet]()
@@ -128,13 +128,13 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
}
}
func removeAllItems() {
mutating func removeAllItems() {
for sectionIndex in sections.indices {
sections[sectionIndex].elements.removeAll()
}
}
func move(itemID: ItemID, before beforeItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
mutating func move(itemID: ItemID, before beforeItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
guard let removed = remove(itemID: itemID) else {
specifiedItemIsNotFound(itemID, file: file, line: line)
}
@@ -146,7 +146,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections[itemPosition.sectionIndex].elements.insert(removed, at: itemPosition.itemRelativeIndex)
}
func move(itemID: ItemID, after afterItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
mutating func move(itemID: ItemID, after afterItemID: ItemID, file: StaticString = #file, line: UInt = #line) {
guard let removed = remove(itemID: itemID) else {
specifiedItemIsNotFound(itemID, file: file, line: line)
}
@@ -159,7 +159,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections[itemPosition.sectionIndex].elements.insert(removed, at: itemIndex)
}
func update(itemIDs: [ItemID], file: StaticString = #file, line: UInt = #line) {
mutating func update(itemIDs: [ItemID], file: StaticString = #file, line: UInt = #line) {
let itemPositionMap = self.itemPositionMap()
for itemID in itemIDs {
@@ -171,12 +171,12 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
}
}
func append(sectionIDs: [SectionID]) {
mutating func append(sectionIDs: [SectionID]) {
let newSections = sectionIDs.lazy.map(Section.init)
sections.append(contentsOf: newSections)
}
func insert(sectionIDs: [SectionID], before beforeSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
mutating func insert(sectionIDs: [SectionID], before beforeSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
guard let sectionIndex = sectionIndex(of: beforeSectionID) else {
specifiedSectionIsNotFound(beforeSectionID, file: file, line: line)
}
@@ -185,7 +185,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections.insert(contentsOf: newSections, at: sectionIndex)
}
func insert(sectionIDs: [SectionID], after afterSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
mutating func insert(sectionIDs: [SectionID], after afterSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
guard let beforeIndex = sectionIndex(of: afterSectionID) else {
specifiedSectionIsNotFound(afterSectionID, file: file, line: line)
}
@@ -195,13 +195,13 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections.insert(contentsOf: newSections, at: sectionIndex)
}
func remove(sectionIDs: [SectionID]) {
mutating func remove(sectionIDs: [SectionID]) {
for sectionID in sectionIDs {
remove(sectionID: sectionID)
}
}
func move(sectionID: SectionID, before beforeSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
mutating func move(sectionID: SectionID, before beforeSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
guard let removed = remove(sectionID: sectionID) else {
specifiedSectionIsNotFound(sectionID, file: file, line: line)
}
@@ -213,7 +213,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections.insert(removed, at: sectionIndex)
}
func move(sectionID: SectionID, after afterSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
mutating func move(sectionID: SectionID, after afterSectionID: SectionID, file: StaticString = #file, line: UInt = #line) {
guard let removed = remove(sectionID: sectionID) else {
specifiedSectionIsNotFound(sectionID, file: file, line: line)
}
@@ -226,7 +226,7 @@ final class SnapshotStructure<SectionID: Hashable, ItemID: Hashable> {
sections.insert(removed, at: sectionIndex)
}
func update(sectionIDs: [SectionID]) {
mutating func update(sectionIDs: [SectionID]) {
for sectionID in sectionIDs {
guard let sectionIndex = sectionIndex(of: sectionID) else {
continue
@@ -250,7 +250,7 @@ private extension SnapshotStructure {
}
@discardableResult
func remove(itemID: ItemID) -> Item? {
mutating func remove(itemID: ItemID) -> Item? {
guard let itemPosition = itemPositionMap()[itemID] else {
return nil
}
@@ -259,7 +259,7 @@ private extension SnapshotStructure {
}
@discardableResult
func remove(sectionID: SectionID) -> Section? {
mutating func remove(sectionID: SectionID) -> Section? {
guard let sectionIndex = sectionIndex(of: sectionID) else {
return nil
}
@@ -39,14 +39,18 @@ open class CollectionViewDiffableDataSource<SectionIdentifierType: Hashable, Ite
/// - snapshot: A snapshot object to be applied to data model.
/// - animatingDifferences: A Boolean value indicating whether to update with
/// diffing animation.
public func apply(_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>, animatingDifferences: Bool = true) {
/// - completion: An optional completion block which is called when the complete
/// performing updates.
public func apply(_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>, animatingDifferences: Bool = true, completion: (() -> Void)? = nil) {
core.apply(
snapshot,
view: collectionView,
animatingDifferences: animatingDifferences,
performUpdates: { collectionView, changeset, setSections in
collectionView.reload(using: changeset, setData: setSections)
})
},
completion: completion
)
}
/// Returns a new snapshot object of current state.
@@ -128,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
@@ -36,14 +36,18 @@ open class TableViewDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
/// - snapshot: A snapshot object to be applied to data model.
/// - animatingDifferences: A Boolean value indicating whether to update with
/// diffing animation.
public func apply(_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>, animatingDifferences: Bool = true) {
/// - completion: An optional completion block which is called when the complete
/// performing updates.
public func apply(_ snapshot: DiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>, animatingDifferences: Bool = true, completion: (() -> Void)? = nil) {
core.apply(
snapshot,
view: tableView,
animatingDifferences: animatingDifferences,
performUpdates: { tableView, changeset, setSections in
tableView.reload(using: changeset, with: self.defaultRowAnimation, setData: setSections)
})
},
completion: completion
)
}
/// Returns a new snapshot object of current state.
@@ -94,6 +98,28 @@ open class TableViewDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
return core.numberOfItems(inSection: section)
}
/// Returns the title for the specified section's header.
///
/// - Parameters:
/// - tableView: A table view instance managed by `self`.
/// - section: An index of section.
///
/// - Returns: The title for the specified section's header, or `nil` for no title.
open func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return nil
}
/// Returns the title for the specified section's footer.
///
/// - Parameters:
/// - tableView: A table view instance managed by `self`.
/// - section: An index of section.
///
/// - Returns: The title for the specified section's footer, or `nil` for no title.
open func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
return nil
}
/// Returns a cell for row at specified index path.
///
/// - Parameters:
@@ -109,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
@@ -20,23 +20,31 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
NSCollectionViewItem()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
dataSource.apply(snapshot)
let e1 = expectation(description: "testApply() e1")
dataSource.apply(snapshot, completion: e1.fulfill)
wait(for: [e1], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 0)
snapshot.appendSections([0])
snapshot.appendItems([0])
dataSource.apply(snapshot)
let e2 = expectation(description: "testApply() e2")
dataSource.apply(snapshot, completion: e2.fulfill)
wait(for: [e2], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 1)
dataSource.apply(snapshot)
let e3 = expectation(description: "testApply() e3")
dataSource.apply(snapshot, completion: e3.fulfill)
wait(for: [e3], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 1)
snapshot.appendItems([1])
dataSource.apply(snapshot)
let e4 = expectation(description: "testApply() e4")
dataSource.apply(snapshot, completion: e4.fulfill)
wait(for: [e4], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 2)
}
@@ -50,33 +58,36 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
XCTAssertEqual(snapshot1.sectionIdentifiers, [])
XCTAssertEqual(snapshot1.itemIdentifiers, [])
dataSource.snapshot().appendSections([0, 1, 2])
let snapshot2 = dataSource.snapshot()
XCTAssertEqual(snapshot2.sectionIdentifiers, [])
XCTAssertEqual(snapshot2.itemIdentifiers, [])
var snapshot2 = dataSource.snapshot()
snapshot2.appendSections([0, 1, 2])
let snapshotToApply = DiffableDataSourceSnapshot<Int, Int>()
let snapshot3 = dataSource.snapshot()
XCTAssertEqual(snapshot3.sectionIdentifiers, [])
XCTAssertEqual(snapshot3.itemIdentifiers, [])
var snapshotToApply = DiffableDataSourceSnapshot<Int, Int>()
snapshotToApply.appendSections([0, 1, 2])
snapshotToApply.appendItems([0, 1, 2])
dataSource.apply(snapshotToApply)
let snapshot3 = dataSource.snapshot()
XCTAssertEqual(snapshot3.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot3.itemIdentifiers, [0, 1, 2])
dataSource.snapshot().appendSections([3, 4, 5])
let snapshot4 = dataSource.snapshot()
XCTAssertEqual(snapshot4.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot4.itemIdentifiers, [0, 1, 2])
snapshot4.appendSections([3, 4, 5])
snapshot4.appendItems([3, 4, 5])
dataSource.apply(snapshot4)
var snapshot5 = dataSource.snapshot()
snapshot5.appendSections([3, 4, 5])
let snapshot5 = dataSource.snapshot()
XCTAssertEqual(snapshot5.sectionIdentifiers, [0, 1, 2, 3, 4, 5])
XCTAssertEqual(snapshot5.itemIdentifiers, [0, 1, 2, 3, 4, 5])
var snapshot6 = dataSource.snapshot()
XCTAssertEqual(snapshot6.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot6.itemIdentifiers, [0, 1, 2])
snapshot6.appendSections([3, 4, 5])
snapshot6.appendItems([3, 4, 5])
dataSource.apply(snapshot6)
let snapshot7 = dataSource.snapshot()
XCTAssertEqual(snapshot7.sectionIdentifiers, [0, 1, 2, 3, 4, 5])
XCTAssertEqual(snapshot7.itemIdentifiers, [0, 1, 2, 3, 4, 5])
}
func testItemIdentifier() {
@@ -85,7 +96,7 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
NSCollectionViewItem()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -100,7 +111,7 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
NSCollectionViewItem()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -117,7 +128,7 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
XCTAssertEqual(dataSource.numberOfSections(in: collectionView), 0)
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -131,7 +142,7 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
NSCollectionViewItem()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -146,7 +157,7 @@ final class CocoaCollectionViewDiffableDataSourceTests: XCTestCase {
item
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -20,23 +20,31 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
UICollectionViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
dataSource.apply(snapshot)
let e1 = expectation(description: "testApply() e1")
dataSource.apply(snapshot, completion: e1.fulfill)
wait(for: [e1], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 0)
snapshot.appendSections([0])
snapshot.appendItems([0])
dataSource.apply(snapshot)
let e2 = expectation(description: "testApply() e2")
dataSource.apply(snapshot, completion: e2.fulfill)
wait(for: [e2], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 1)
dataSource.apply(snapshot)
let e3 = expectation(description: "testApply() e3")
dataSource.apply(snapshot, completion: e3.fulfill)
wait(for: [e3], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 1)
snapshot.appendItems([1])
dataSource.apply(snapshot)
let e4 = expectation(description: "testApply() e4")
dataSource.apply(snapshot, completion: e4.fulfill)
wait(for: [e4], timeout: 1)
XCTAssertEqual(collectionView.isPerformBatchUpdatesCalledCount, 2)
}
@@ -50,33 +58,36 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
XCTAssertEqual(snapshot1.sectionIdentifiers, [])
XCTAssertEqual(snapshot1.itemIdentifiers, [])
dataSource.snapshot().appendSections([0, 1, 2])
let snapshot2 = dataSource.snapshot()
XCTAssertEqual(snapshot2.sectionIdentifiers, [])
XCTAssertEqual(snapshot2.itemIdentifiers, [])
var snapshot2 = dataSource.snapshot()
snapshot2.appendSections([0, 1, 2])
let snapshotToApply = DiffableDataSourceSnapshot<Int, Int>()
let snapshot3 = dataSource.snapshot()
XCTAssertEqual(snapshot3.sectionIdentifiers, [])
XCTAssertEqual(snapshot3.itemIdentifiers, [])
var snapshotToApply = DiffableDataSourceSnapshot<Int, Int>()
snapshotToApply.appendSections([0, 1, 2])
snapshotToApply.appendItems([0, 1, 2])
dataSource.apply(snapshotToApply)
let snapshot3 = dataSource.snapshot()
XCTAssertEqual(snapshot3.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot3.itemIdentifiers, [0, 1, 2])
dataSource.snapshot().appendSections([3, 4, 5])
let snapshot4 = dataSource.snapshot()
XCTAssertEqual(snapshot4.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot4.itemIdentifiers, [0, 1, 2])
snapshot4.appendSections([3, 4, 5])
snapshot4.appendItems([3, 4, 5])
dataSource.apply(snapshot4)
var snapshot5 = dataSource.snapshot()
snapshot5.appendSections([3, 4, 5])
let snapshot5 = dataSource.snapshot()
XCTAssertEqual(snapshot5.sectionIdentifiers, [0, 1, 2, 3, 4, 5])
XCTAssertEqual(snapshot5.itemIdentifiers, [0, 1, 2, 3, 4, 5])
var snapshot6 = dataSource.snapshot()
XCTAssertEqual(snapshot6.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot6.itemIdentifiers, [0, 1, 2])
snapshot6.appendSections([3, 4, 5])
snapshot6.appendItems([3, 4, 5])
dataSource.apply(snapshot6)
let snapshot7 = dataSource.snapshot()
XCTAssertEqual(snapshot7.sectionIdentifiers, [0, 1, 2, 3, 4, 5])
XCTAssertEqual(snapshot7.itemIdentifiers, [0, 1, 2, 3, 4, 5])
}
func testItemIdentifier() {
@@ -85,7 +96,7 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
UICollectionViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -100,7 +111,7 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
UICollectionViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -117,7 +128,7 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
XCTAssertEqual(dataSource.numberOfSections(in: collectionView), 0)
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -131,7 +142,7 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
UICollectionViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -146,7 +157,7 @@ final class CollectionViewDiffableDataSourceTests: XCTestCase {
cell
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -156,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 {
+41 -41
View File
@@ -16,7 +16,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.appendSections(test.append)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -33,7 +33,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.appendSections(test.append)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -51,7 +51,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.insertSections(test.insert, beforeSection: test.before)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -67,7 +67,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.insertSections(test.insert, beforeSection: test.before)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -86,7 +86,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.insertSections(test.insert, afterSection: test.after)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -102,7 +102,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.insertSections(test.insert, afterSection: test.after)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -122,7 +122,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.deleteSections(test.delete)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -140,7 +140,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.moveSection(test.move, beforeSection: test.before)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -158,7 +158,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.moveSection(test.move, afterSection: test.after)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -194,7 +194,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
snapshot.reloadSections(test.reload)
XCTAssertEqual(snapshot.sectionIdentifiers, test.initial)
@@ -213,7 +213,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1])
snapshot.appendItems(test.initial)
snapshot.appendItems(test.append)
@@ -231,7 +231,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1])
snapshot.appendItems(test.initial)
snapshot.appendItems(test.append)
@@ -253,7 +253,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items)
@@ -276,7 +276,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items)
@@ -302,7 +302,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1])
snapshot.appendItems(test.initial)
snapshot.insertItems(test.insert, beforeItem: test.before)
@@ -320,7 +320,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1])
snapshot.appendItems(test.initial)
snapshot.insertItems(test.insert, beforeItem: test.before)
@@ -341,7 +341,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1])
snapshot.appendItems(test.initial)
snapshot.insertItems(test.insert, afterItem: test.after)
@@ -359,7 +359,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1])
snapshot.appendItems(test.initial)
snapshot.insertItems(test.insert, afterItem: test.after)
@@ -382,7 +382,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -409,7 +409,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -435,7 +435,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -463,7 +463,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -539,7 +539,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -564,7 +564,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -583,7 +583,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -602,7 +602,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
XCTAssertEqual(snapshot.numberOfSections, test.expected)
@@ -618,7 +618,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
XCTAssertEqual(snapshot.numberOfSections, test.expected)
@@ -636,7 +636,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -655,7 +655,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -674,7 +674,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -690,7 +690,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
XCTAssertEqual(snapshot.sectionIdentifiers, test.expected)
@@ -708,7 +708,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -727,7 +727,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -748,7 +748,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -767,7 +767,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -789,7 +789,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -808,7 +808,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -830,7 +830,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -849,7 +849,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
for (section, items) in test.initial.enumerated() {
snapshot.appendSections([section])
snapshot.appendItems(items, toSection: section)
@@ -870,7 +870,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
XCTAssertEqual(snapshot.indexOfSection(test.section), test.expectedIndex)
@@ -886,7 +886,7 @@ final class DiffableDataSourceSnapshotTests: XCTestCase {
]
for test in tests {
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections(test.initial)
XCTAssertEqual(snapshot.indexOfSection(test.section), test.expectedIndex)
+74 -27
View File
@@ -20,23 +20,31 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
UITableViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
dataSource.apply(snapshot)
let e1 = expectation(description: "testApply() e1")
dataSource.apply(snapshot, completion: e1.fulfill)
wait(for: [e1], timeout: 1)
XCTAssertEqual(tableView.isPerformBatchUpdatesCalledCount, 0)
snapshot.appendSections([0])
snapshot.appendItems([0])
dataSource.apply(snapshot)
let e2 = expectation(description: "testApply() e2")
dataSource.apply(snapshot, completion: e2.fulfill)
wait(for: [e2], timeout: 1)
XCTAssertEqual(tableView.isPerformBatchUpdatesCalledCount, 1)
dataSource.apply(snapshot)
let e3 = expectation(description: "testApply() e3")
dataSource.apply(snapshot, completion: e3.fulfill)
wait(for: [e3], timeout: 1)
XCTAssertEqual(tableView.isPerformBatchUpdatesCalledCount, 1)
snapshot.appendItems([1])
dataSource.apply(snapshot)
let e4 = expectation(description: "testApply() e4")
dataSource.apply(snapshot, completion: e4.fulfill)
wait(for: [e4], timeout: 1)
XCTAssertEqual(tableView.isPerformBatchUpdatesCalledCount, 2)
}
@@ -50,33 +58,36 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
XCTAssertEqual(snapshot1.sectionIdentifiers, [])
XCTAssertEqual(snapshot1.itemIdentifiers, [])
dataSource.snapshot().appendSections([0, 1, 2])
let snapshot2 = dataSource.snapshot()
XCTAssertEqual(snapshot2.sectionIdentifiers, [])
XCTAssertEqual(snapshot2.itemIdentifiers, [])
var snapshot2 = dataSource.snapshot()
snapshot2.appendSections([0, 1, 2])
let snapshotToApply = DiffableDataSourceSnapshot<Int, Int>()
let snapshot3 = dataSource.snapshot()
XCTAssertEqual(snapshot3.sectionIdentifiers, [])
XCTAssertEqual(snapshot3.itemIdentifiers, [])
var snapshotToApply = DiffableDataSourceSnapshot<Int, Int>()
snapshotToApply.appendSections([0, 1, 2])
snapshotToApply.appendItems([0, 1, 2])
dataSource.apply(snapshotToApply)
let snapshot3 = dataSource.snapshot()
XCTAssertEqual(snapshot3.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot3.itemIdentifiers, [0, 1, 2])
dataSource.snapshot().appendSections([3, 4, 5])
let snapshot4 = dataSource.snapshot()
XCTAssertEqual(snapshot4.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot4.itemIdentifiers, [0, 1, 2])
snapshot4.appendSections([3, 4, 5])
snapshot4.appendItems([3, 4, 5])
dataSource.apply(snapshot4)
var snapshot5 = dataSource.snapshot()
snapshot5.appendSections([3, 4, 5])
let snapshot5 = dataSource.snapshot()
XCTAssertEqual(snapshot5.sectionIdentifiers, [0, 1, 2, 3, 4, 5])
XCTAssertEqual(snapshot5.itemIdentifiers, [0, 1, 2, 3, 4, 5])
var snapshot6 = dataSource.snapshot()
XCTAssertEqual(snapshot6.sectionIdentifiers, [0, 1, 2])
XCTAssertEqual(snapshot6.itemIdentifiers, [0, 1, 2])
snapshot6.appendSections([3, 4, 5])
snapshot6.appendItems([3, 4, 5])
dataSource.apply(snapshot6)
let snapshot7 = dataSource.snapshot()
XCTAssertEqual(snapshot7.sectionIdentifiers, [0, 1, 2, 3, 4, 5])
XCTAssertEqual(snapshot7.itemIdentifiers, [0, 1, 2, 3, 4, 5])
}
func testItemIdentifier() {
@@ -85,7 +96,7 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
UITableViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -100,7 +111,7 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
UITableViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -117,7 +128,7 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
XCTAssertEqual(dataSource.numberOfSections(in: tableView), 0)
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -131,7 +142,7 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
UITableViewCell()
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -146,7 +157,7 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
cell
}
let snapshot = DiffableDataSourceSnapshot<Int, Int>()
var snapshot = DiffableDataSourceSnapshot<Int, Int>()
snapshot.appendSections([0, 1, 2])
snapshot.appendItems([0, 1, 2], toSection: 0)
dataSource.apply(snapshot)
@@ -156,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 {
+3 -3
View File
@@ -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
+4 -2
View File
@@ -10,6 +10,8 @@ jobs:
matrix:
xcode10_2:
DEVELOPER_DIR: /Applications/Xcode_10.2.app
xcode11_2_1:
DEVELOPER_DIR: /Applications/Xcode_11.2.1.app
steps:
- checkout: self
submodules: true
@@ -20,11 +22,11 @@ jobs:
set -o pipefail &&
xcodebuild build-for-testing test-without-building -workspace DiffableDataSources.xcworkspace -scheme DiffableDataSources -configuration Release ENABLE_TESTABILITY=YES |
xcpretty -c -r junit -o build/reports/xcodebuild-macOS.xml
displayName: xcodebuild test maxOS
displayName: xcodebuild test macOS
condition: succeededOrFailed()
- script: |
set -o pipefail &&
xcodebuild build-for-testing test-without-building -workspace DiffableDataSources.xcworkspace -scheme DiffableDataSources -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone Xs' ENABLE_TESTABILITY=YES |
xcodebuild build-for-testing test-without-building -workspace DiffableDataSources.xcworkspace -scheme DiffableDataSources -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8' ENABLE_TESTABILITY=YES |
xcpretty -c -r junit -o build/reports/xcodebuild-iOS.xml
displayName: xcodebuild test iOS
condition: succeededOrFailed()
@@ -23,7 +23,7 @@
<a class="header-link" href="../index.html">
DiffableDataSources Docs
</a>
(100% documented)
(98% documented)
</p>
<p class="header-col--secondary">
@@ -65,7 +65,7 @@
<a class="nav-group-name-link" href="../Snapshot.html">Snapshot</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
<a class="nav-group-task-link" href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
</li>
</ul>
</li>
@@ -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">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;.</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>
@@ -235,9 +235,9 @@ changes with automatic diffing.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources014CollectionViewaB6SourceC5apply_20animatingDifferencesyAA0abF8SnapshotCyxq_G_SbtF"></a>
<a name="//apple_ref/swift/Method/apply(_:animatingDifferences:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources014CollectionViewaB6SourceC5apply_20animatingDifferencesyAA0abF8SnapshotCyxq_G_SbtF">apply(_:animatingDifferences:)</a>
<a name="/s:19DiffableDataSources014CollectionViewaB6SourceC5apply_20animatingDifferences10completionyAA0abF8SnapshotVyxq_G_SbyycSgtF"></a>
<a name="//apple_ref/swift/Method/apply(_:animatingDifferences:completion:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources014CollectionViewaB6SourceC5apply_20animatingDifferences10completionyAA0abF8SnapshotVyxq_G_SbyycSgtF">apply(_:animatingDifferences:completion:)</a>
</code>
</div>
<div class="height-container">
@@ -252,7 +252,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="kd">func</span> <span class="nf">apply</span><span class="p">(</span><span class="n">_</span> <span class="nv">snapshot</span><span class="p">:</span> <span class="kt"><a href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span><span class="p">,</span> <span class="nv">animatingDifferences</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">apply</span><span class="p">(</span><span class="n">_</span> <span class="nv">snapshot</span><span class="p">:</span> <span class="kt"><a href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span><span class="p">,</span> <span class="nv">animatingDifferences</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">(()</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -285,6 +285,19 @@ changes with automatic diffing.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>completion</em>
</code>
</td>
<td>
<div>
<p>An optional completion block which is called when the complete
performing updates.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
@@ -294,9 +307,9 @@ changes with automatic diffing.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources014CollectionViewaB6SourceC8snapshotAA0abF8SnapshotCyxq_GyF"></a>
<a name="/s:19DiffableDataSources014CollectionViewaB6SourceC8snapshotAA0abF8SnapshotVyxq_GyF"></a>
<a name="//apple_ref/swift/Method/snapshot()" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources014CollectionViewaB6SourceC8snapshotAA0abF8SnapshotCyxq_GyF">snapshot()</a>
<a class="token" href="#/s:19DiffableDataSources014CollectionViewaB6SourceC8snapshotAA0abF8SnapshotVyxq_GyF">snapshot()</a>
</code>
</div>
<div class="height-container">
@@ -311,7 +324,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="kd">func</span> <span class="nf">snapshot</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">snapshot</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span></code></pre>
</div>
</div>
@@ -670,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">-&gt;</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>
@@ -678,8 +827,8 @@ changes with automatic diffing.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-06-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 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>
</div>
+544 -11
View File
@@ -23,7 +23,7 @@
<a class="header-link" href="../index.html">
DiffableDataSources Docs
</a>
(100% documented)
(98% documented)
</p>
<p class="header-col--secondary">
@@ -65,7 +65,7 @@
<a class="nav-group-name-link" href="../Snapshot.html">Snapshot</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
<a class="nav-group-task-link" href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
</li>
</ul>
</li>
@@ -208,9 +208,9 @@ changes with automatic diffing.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources09TableViewaB6SourceC5apply_20animatingDifferencesyAA0abF8SnapshotCyxq_G_SbtF"></a>
<a name="//apple_ref/swift/Method/apply(_:animatingDifferences:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC5apply_20animatingDifferencesyAA0abF8SnapshotCyxq_G_SbtF">apply(_:animatingDifferences:)</a>
<a name="/s:19DiffableDataSources09TableViewaB6SourceC5apply_20animatingDifferences10completionyAA0abF8SnapshotVyxq_G_SbyycSgtF"></a>
<a name="//apple_ref/swift/Method/apply(_:animatingDifferences:completion:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC5apply_20animatingDifferences10completionyAA0abF8SnapshotVyxq_G_SbyycSgtF">apply(_:animatingDifferences:completion:)</a>
</code>
</div>
<div class="height-container">
@@ -225,7 +225,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="kd">func</span> <span class="nf">apply</span><span class="p">(</span><span class="n">_</span> <span class="nv">snapshot</span><span class="p">:</span> <span class="kt"><a href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span><span class="p">,</span> <span class="nv">animatingDifferences</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">apply</span><span class="p">(</span><span class="n">_</span> <span class="nv">snapshot</span><span class="p">:</span> <span class="kt"><a href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span><span class="p">,</span> <span class="nv">animatingDifferences</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">(()</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -258,6 +258,19 @@ changes with automatic diffing.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>completion</em>
</code>
</td>
<td>
<div>
<p>An optional completion block which is called when the complete
performing updates.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
@@ -267,9 +280,9 @@ changes with automatic diffing.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources09TableViewaB6SourceC8snapshotAA0abF8SnapshotCyxq_GyF"></a>
<a name="/s:19DiffableDataSources09TableViewaB6SourceC8snapshotAA0abF8SnapshotVyxq_GyF"></a>
<a name="//apple_ref/swift/Method/snapshot()" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC8snapshotAA0abF8SnapshotCyxq_GyF">snapshot()</a>
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC8snapshotAA0abF8SnapshotVyxq_GyF">snapshot()</a>
</code>
</div>
<div class="height-container">
@@ -284,7 +297,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="kd">func</span> <span class="nf">snapshot</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">snapshot</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span></code></pre>
</div>
</div>
@@ -507,6 +520,130 @@ changes with automatic diffing.</p>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_23titleForHeaderInSectionSSSgSo07UITableE0C_SitF"></a>
<a name="//apple_ref/swift/Method/tableView(_:titleForHeaderInSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_23titleForHeaderInSectionSSSgSo07UITableE0C_SitF">tableView(_:titleForHeaderInSection:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the title for the specified section&rsquo;s header.</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">titleForHeaderInSection</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</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>
<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>The title for the specified section&rsquo;s header, or <code>nil</code> for no title.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_23titleForFooterInSectionSSSgSo07UITableE0C_SitF"></a>
<a name="//apple_ref/swift/Method/tableView(_:titleForFooterInSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources09TableViewaB6SourceC05tableE0_23titleForFooterInSectionSSSgSo07UITableE0C_SitF">tableView(_:titleForFooterInSection:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns the title for the specified section&rsquo;s footer.</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">titleForFooterInSection</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</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>
<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>The title for the specified section&rsquo;s footer, or <code>nil</code> for no title.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
@@ -569,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">-&gt;</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">-&gt;</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&hellip;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">-&gt;</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">-&gt;</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>
@@ -577,8 +1110,8 @@ changes with automatic diffing.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-06-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 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>
</div>
+4 -4
View File
@@ -23,7 +23,7 @@
<a class="header-link" href="index.html">
DiffableDataSources Docs
</a>
(100% documented)
(98% documented)
</p>
<p class="header-col--secondary">
@@ -65,7 +65,7 @@
<a class="nav-group-name-link" href="Snapshot.html">Snapshot</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
<a class="nav-group-task-link" href="Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
</li>
</ul>
</li>
@@ -156,8 +156,8 @@ changes with automatic diffing.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-06-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 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>
</div>
+9 -9
View File
@@ -23,7 +23,7 @@
<a class="header-link" href="index.html">
DiffableDataSources Docs
</a>
(100% documented)
(98% documented)
</p>
<p class="header-col--secondary">
@@ -65,7 +65,7 @@
<a class="nav-group-name-link" href="Snapshot.html">Snapshot</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
<a class="nav-group-task-link" href="Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
</li>
</ul>
</li>
@@ -87,9 +87,9 @@
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC"></a>
<a name="//apple_ref/swift/Class/DiffableDataSourceSnapshot" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC">DiffableDataSourceSnapshot</a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV"></a>
<a name="//apple_ref/swift/Struct/DiffableDataSourceSnapshot" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV">DiffableDataSourceSnapshot</a>
</code>
</div>
<div class="height-container">
@@ -100,13 +100,13 @@
<p>A class for backporting <code>NSDiffableDataSourceSnapshot</code> introduced in iOS 13.0+, macOS 10.15+, tvOS 13.0+.
Represents the mutable state of diffable data source of UI.</p>
<a href="Classes/DiffableDataSourceSnapshot.html" class="slightly-smaller">See more</a>
<a href="Structs/DiffableDataSourceSnapshot.html" class="slightly-smaller">See more</a>
</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">class</span> <span class="kt">DiffableDataSourceSnapshot</span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span> <span class="k">where</span> <span class="kt">SectionIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DiffableDataSourceSnapshot</span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span> <span class="k">where</span> <span class="kt">SectionIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
@@ -121,8 +121,8 @@ Represents the mutable state of diffable data source of UI.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-06-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 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>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>DiffableDataSourceSnapshot Class Reference</title>
<title>DiffableDataSourceSnapshot Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -14,16 +14,16 @@
</head>
<body>
<a name="//apple_ref/swift/Class/DiffableDataSourceSnapshot" class="dashAnchor"></a>
<a name="//apple_ref/swift/Struct/DiffableDataSourceSnapshot" class="dashAnchor"></a>
<a title="DiffableDataSourceSnapshot Class Reference"></a>
<a title="DiffableDataSourceSnapshot Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
DiffableDataSources Docs
</a>
(100% documented)
(98% documented)
</p>
<p class="header-col--secondary">
@@ -44,7 +44,7 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">DiffableDataSources Reference</a>
<img class="carat" src="../img/carat.png" />
DiffableDataSourceSnapshot Class Reference
DiffableDataSourceSnapshot Structure Reference
</p>
<div class="content-wrapper">
@@ -65,7 +65,7 @@
<a class="nav-group-name-link" href="../Snapshot.html">Snapshot</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
<a class="nav-group-task-link" href="../Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
</li>
</ul>
</li>
@@ -78,7 +78,7 @@
<h1>DiffableDataSourceSnapshot</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kt">DiffableDataSourceSnapshot</span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span> <span class="k">where</span> <span class="kt">SectionIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">DiffableDataSourceSnapshot</span><span class="o">&lt;</span><span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span><span class="o">&gt;</span> <span class="k">where</span> <span class="kt">SectionIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span><span class="p">,</span> <span class="kt">ItemIdentifierType</span> <span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
@@ -95,9 +95,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotCACyxq_Gycfc"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotVACyxq_Gycfc"></a>
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotCACyxq_Gycfc">init()</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotVACyxq_Gycfc">init()</a>
</code>
</div>
<div class="height-container">
@@ -122,9 +122,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC13numberOfItemsSivp"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV13numberOfItemsSivp"></a>
<a name="//apple_ref/swift/Property/numberOfItems" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC13numberOfItemsSivp">numberOfItems</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV13numberOfItemsSivp">numberOfItems</a>
</code>
</div>
<div class="height-container">
@@ -149,9 +149,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC16numberOfSectionsSivp"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV16numberOfSectionsSivp"></a>
<a name="//apple_ref/swift/Property/numberOfSections" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC16numberOfSectionsSivp">numberOfSections</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV16numberOfSectionsSivp">numberOfSections</a>
</code>
</div>
<div class="height-container">
@@ -176,9 +176,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC18sectionIdentifiersSayxGvp"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV18sectionIdentifiersSayxGvp"></a>
<a name="//apple_ref/swift/Property/sectionIdentifiers" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC18sectionIdentifiersSayxGvp">sectionIdentifiers</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV18sectionIdentifiersSayxGvp">sectionIdentifiers</a>
</code>
</div>
<div class="height-container">
@@ -203,9 +203,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC15itemIdentifiersSayq_Gvp"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV15itemIdentifiersSayq_Gvp"></a>
<a name="//apple_ref/swift/Property/itemIdentifiers" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC15itemIdentifiersSayq_Gvp">itemIdentifiers</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV15itemIdentifiersSayq_Gvp">itemIdentifiers</a>
</code>
</div>
<div class="height-container">
@@ -230,9 +230,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC13numberOfItems9inSectionSix_tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV13numberOfItems9inSectionSix_tF"></a>
<a name="//apple_ref/swift/Method/numberOfItems(inSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC13numberOfItems9inSectionSix_tF">numberOfItems(inSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV13numberOfItems9inSectionSix_tF">numberOfItems(inSection:)</a>
</code>
</div>
<div class="height-container">
@@ -280,9 +280,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC15itemIdentifiers9inSectionSayq_Gx_tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV15itemIdentifiers9inSectionSayq_Gx_tF"></a>
<a name="//apple_ref/swift/Method/itemIdentifiers(inSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC15itemIdentifiers9inSectionSayq_Gx_tF">itemIdentifiers(inSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV15itemIdentifiers9inSectionSayq_Gx_tF">itemIdentifiers(inSection:)</a>
</code>
</div>
<div class="height-container">
@@ -330,9 +330,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC17sectionIdentifier14containingItemxSgq__tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV17sectionIdentifier14containingItemxSgq__tF"></a>
<a name="//apple_ref/swift/Method/sectionIdentifier(containingItem:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC17sectionIdentifier14containingItemxSgq__tF">sectionIdentifier(containingItem:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV17sectionIdentifier14containingItemxSgq__tF">sectionIdentifier(containingItem:)</a>
</code>
</div>
<div class="height-container">
@@ -380,9 +380,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11indexOfItemySiSgq_F"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11indexOfItemySiSgq_F"></a>
<a name="//apple_ref/swift/Method/indexOfItem(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11indexOfItemySiSgq_F">indexOfItem(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11indexOfItemySiSgq_F">indexOfItem(_:)</a>
</code>
</div>
<div class="height-container">
@@ -430,9 +430,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14indexOfSectionySiSgxF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14indexOfSectionySiSgxF"></a>
<a name="//apple_ref/swift/Method/indexOfSection(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14indexOfSectionySiSgxF">indexOfSection(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14indexOfSectionySiSgxF">indexOfSection(_:)</a>
</code>
</div>
<div class="height-container">
@@ -480,9 +480,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11appendItems_9toSectionySayq_G_xSgtF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11appendItems_9toSectionySayq_G_xSgtF"></a>
<a name="//apple_ref/swift/Method/appendItems(_:toSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11appendItems_9toSectionySayq_G_xSgtF">appendItems(_:toSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11appendItems_9toSectionySayq_G_xSgtF">appendItems(_:toSection:)</a>
</code>
</div>
<div class="height-container">
@@ -497,7 +497,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">appendItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">],</span> <span class="n">toSection</span> <span class="nv">sectionIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">appendItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">],</span> <span class="n">toSection</span> <span class="nv">sectionIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -538,9 +538,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11insertItems_10beforeItemySayq_G_q_tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11insertItems_10beforeItemySayq_G_q_tF"></a>
<a name="//apple_ref/swift/Method/insertItems(_:beforeItem:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11insertItems_10beforeItemySayq_G_q_tF">insertItems(_:beforeItem:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11insertItems_10beforeItemySayq_G_q_tF">insertItems(_:beforeItem:)</a>
</code>
</div>
<div class="height-container">
@@ -555,7 +555,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">insertItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">],</span> <span class="n">beforeItem</span> <span class="nv">beforeIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">insertItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">],</span> <span class="n">beforeItem</span> <span class="nv">beforeIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -596,9 +596,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11insertItems_9afterItemySayq_G_q_tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11insertItems_9afterItemySayq_G_q_tF"></a>
<a name="//apple_ref/swift/Method/insertItems(_:afterItem:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11insertItems_9afterItemySayq_G_q_tF">insertItems(_:afterItem:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11insertItems_9afterItemySayq_G_q_tF">insertItems(_:afterItem:)</a>
</code>
</div>
<div class="height-container">
@@ -613,7 +613,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">insertItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">],</span> <span class="n">afterItem</span> <span class="nv">afterIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">insertItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">],</span> <span class="n">afterItem</span> <span class="nv">afterIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -654,9 +654,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11deleteItemsyySayq_GF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11deleteItemsyySayq_GF"></a>
<a name="//apple_ref/swift/Method/deleteItems(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11deleteItemsyySayq_GF">deleteItems(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11deleteItemsyySayq_GF">deleteItems(_:)</a>
</code>
</div>
<div class="height-container">
@@ -671,7 +671,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">deleteItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">deleteItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">])</span></code></pre>
</div>
</div>
@@ -700,9 +700,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14deleteAllItemsyyF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14deleteAllItemsyyF"></a>
<a name="//apple_ref/swift/Method/deleteAllItems()" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14deleteAllItemsyyF">deleteAllItems()</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14deleteAllItemsyyF">deleteAllItems()</a>
</code>
</div>
<div class="height-container">
@@ -717,7 +717,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">deleteAllItems</span><span class="p">()</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">deleteAllItems</span><span class="p">()</span></code></pre>
</div>
</div>
@@ -727,9 +727,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC8moveItem_06beforeG0yq__q_tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV8moveItem_06beforeG0yq__q_tF"></a>
<a name="//apple_ref/swift/Method/moveItem(_:beforeItem:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC8moveItem_06beforeG0yq__q_tF">moveItem(_:beforeItem:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV8moveItem_06beforeG0yq__q_tF">moveItem(_:beforeItem:)</a>
</code>
</div>
<div class="height-container">
@@ -744,7 +744,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">moveItem</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">,</span> <span class="n">beforeItem</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">moveItem</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">,</span> <span class="n">beforeItem</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -785,9 +785,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC8moveItem_05afterG0yq__q_tF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV8moveItem_05afterG0yq__q_tF"></a>
<a name="//apple_ref/swift/Method/moveItem(_:afterItem:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC8moveItem_05afterG0yq__q_tF">moveItem(_:afterItem:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV8moveItem_05afterG0yq__q_tF">moveItem(_:afterItem:)</a>
</code>
</div>
<div class="height-container">
@@ -802,7 +802,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">moveItem</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">,</span> <span class="n">afterItem</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">moveItem</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">,</span> <span class="n">afterItem</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">ItemIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -843,9 +843,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11reloadItemsyySayq_GF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11reloadItemsyySayq_GF"></a>
<a name="//apple_ref/swift/Method/reloadItems(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11reloadItemsyySayq_GF">reloadItems(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11reloadItemsyySayq_GF">reloadItems(_:)</a>
</code>
</div>
<div class="height-container">
@@ -860,7 +860,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">reloadItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">reloadItems</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">ItemIdentifierType</span><span class="p">])</span></code></pre>
</div>
</div>
@@ -889,9 +889,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14appendSectionsyySayxGF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14appendSectionsyySayxGF"></a>
<a name="//apple_ref/swift/Method/appendSections(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14appendSectionsyySayxGF">appendSections(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14appendSectionsyySayxGF">appendSections(_:)</a>
</code>
</div>
<div class="height-container">
@@ -906,7 +906,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">appendSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">appendSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">])</span></code></pre>
</div>
</div>
@@ -935,9 +935,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14insertSections_13beforeSectionySayxG_xtF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14insertSections_13beforeSectionySayxG_xtF"></a>
<a name="//apple_ref/swift/Method/insertSections(_:beforeSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14insertSections_13beforeSectionySayxG_xtF">insertSections(_:beforeSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14insertSections_13beforeSectionySayxG_xtF">insertSections(_:beforeSection:)</a>
</code>
</div>
<div class="height-container">
@@ -952,7 +952,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">insertSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">],</span> <span class="n">beforeSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">insertSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">],</span> <span class="n">beforeSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -993,9 +993,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14insertSections_12afterSectionySayxG_xtF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14insertSections_12afterSectionySayxG_xtF"></a>
<a name="//apple_ref/swift/Method/insertSections(_:afterSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14insertSections_12afterSectionySayxG_xtF">insertSections(_:afterSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14insertSections_12afterSectionySayxG_xtF">insertSections(_:afterSection:)</a>
</code>
</div>
<div class="height-container">
@@ -1010,7 +1010,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">insertSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">],</span> <span class="n">afterSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">insertSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">],</span> <span class="n">afterSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -1051,9 +1051,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14deleteSectionsyySayxGF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14deleteSectionsyySayxGF"></a>
<a name="//apple_ref/swift/Method/deleteSections(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14deleteSectionsyySayxGF">deleteSections(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14deleteSectionsyySayxGF">deleteSections(_:)</a>
</code>
</div>
<div class="height-container">
@@ -1068,7 +1068,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">deleteSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">deleteSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">])</span></code></pre>
</div>
</div>
@@ -1097,9 +1097,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11moveSection_06beforeG0yx_xtF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11moveSection_06beforeG0yx_xtF"></a>
<a name="//apple_ref/swift/Method/moveSection(_:beforeSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11moveSection_06beforeG0yx_xtF">moveSection(_:beforeSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11moveSection_06beforeG0yx_xtF">moveSection(_:beforeSection:)</a>
</code>
</div>
<div class="height-container">
@@ -1114,7 +1114,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">moveSection</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="n">beforeSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">moveSection</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="n">beforeSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -1155,9 +1155,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC11moveSection_05afterG0yx_xtF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV11moveSection_05afterG0yx_xtF"></a>
<a name="//apple_ref/swift/Method/moveSection(_:afterSection:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC11moveSection_05afterG0yx_xtF">moveSection(_:afterSection:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV11moveSection_05afterG0yx_xtF">moveSection(_:afterSection:)</a>
</code>
</div>
<div class="height-container">
@@ -1172,7 +1172,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">moveSection</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="n">afterSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">moveSection</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">,</span> <span class="n">afterSection</span> <span class="nv">toIdentifier</span><span class="p">:</span> <span class="kt">SectionIdentifierType</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -1213,9 +1213,9 @@ Represents the mutable state of diffable data source of UI.</p>
<li class="item">
<div>
<code>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotC14reloadSectionsyySayxGF"></a>
<a name="/s:19DiffableDataSources0aB14SourceSnapshotV14reloadSectionsyySayxGF"></a>
<a name="//apple_ref/swift/Method/reloadSections(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotC14reloadSectionsyySayxGF">reloadSections(_:)</a>
<a class="token" href="#/s:19DiffableDataSources0aB14SourceSnapshotV14reloadSectionsyySayxGF">reloadSections(_:)</a>
</code>
</div>
<div class="height-container">
@@ -1230,7 +1230,7 @@ Represents the mutable state of diffable data source of UI.</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="kd">func</span> <span class="nf">reloadSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">reloadSections</span><span class="p">(</span><span class="n">_</span> <span class="nv">identifiers</span><span class="p">:</span> <span class="p">[</span><span class="kt">SectionIdentifierType</span><span class="p">])</span></code></pre>
</div>
</div>
@@ -1264,8 +1264,8 @@ Represents the mutable state of diffable data source of UI.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-06-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 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>
</div>
+8 -8
View File
@@ -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

+13 -3
View File
@@ -63,6 +63,10 @@ a {
a:hover, a:focus {
outline: 0;
text-decoration: underline; }
a.discouraged {
text-decoration: line-through; }
a.discouraged:hover, a.discouraged:focus {
text-decoration: underline line-through; }
table {
background: #fff;
@@ -225,7 +229,7 @@ pre code {
.item a[name]:before {
content: "";
display: block; }
.item .token {
.item .token, .item .direct-link {
padding-left: 3px;
margin-left: 0px;
font-size: 1rem; }
@@ -287,9 +291,9 @@ pre code {
.language .aside-title {
color: #4183c4; }
.aside-warning {
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
@@ -325,6 +329,7 @@ pre code {
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
display: none; }
html.dash .height-container {
display: block; }
@@ -338,14 +343,17 @@ form[role=search] input {
border-radius: 1em; }
.loading form[role=search] input {
background: white url(../img/spinner.gif) center right 4px no-repeat; }
form[role=search] .tt-menu {
margin: 0;
min-width: 300px;
background: #fbfbfb;
color: #333;
border: 1px solid #ddd; }
form[role=search] .tt-highlight {
font-weight: bold; }
form[role=search] .tt-suggestion {
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0 8px; }
@@ -358,11 +366,13 @@ form[role=search] .tt-suggestion {
font-weight: normal;
font-size: 0.9em;
padding-left: 16px; }
form[role=search] .tt-suggestion:hover,
form[role=search] .tt-suggestion.tt-cursor {
cursor: pointer;
background-color: #4183c4;
color: #fff; }
form[role=search] .tt-suggestion:hover .doc-parent-name,
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
color: #fff; }
+9 -7
View File
@@ -22,7 +22,7 @@
<a class="header-link" href="index.html">
DiffableDataSources Docs
</a>
(100% documented)
(98% documented)
</p>
<p class="header-col--secondary">
@@ -64,7 +64,7 @@
<a class="nav-group-name-link" href="Snapshot.html">Snapshot</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
<a class="nav-group-task-link" href="Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a>
</li>
</ul>
</li>
@@ -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>
@@ -207,7 +207,7 @@ You should dequeue the non nil cells via closure. </p>
<span class="p">}</span>
</code></pre>
<p>Manages and updates the data sources intuitively by intermediating <code><a href="Classes/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></code>.<br>
<p>Manages and updates the data sources intuitively by intermediating <code><a href="Structs/DiffableDataSourceSnapshot.html">DiffableDataSourceSnapshot</a></code>.<br>
The UI isn&rsquo;t updated until you apply the edited snapshot object.<br>
Update the UI with diffing animation automatically calculated by applying an edited snapshot. </p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">users</span> <span class="o">=</span> <span class="p">[</span>
@@ -221,7 +221,9 @@ Update the UI with diffing animation automatically calculated by applying an edi
<span class="n">snapshot</span><span class="o">.</span><span class="nf">appendSections</span><span class="p">([</span><span class="o">.</span><span class="n">main</span><span class="p">])</span>
<span class="n">snapshot</span><span class="o">.</span><span class="nf">appendItems</span><span class="p">(</span><span class="n">users</span><span class="p">)</span>
<span class="n">dataSource</span><span class="o">.</span><span class="nf">apply</span><span class="p">(</span><span class="n">snapshot</span><span class="p">)</span>
<span class="n">dataSource</span><span class="o">.</span><span class="nf">apply</span><span class="p">(</span><span class="n">snapshot</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// completion</span>
<span class="p">}</span>
</code></pre>
<p>Check the documentation for more detailed API. </p>
@@ -285,8 +287,8 @@ Please see the <a href="https://github.com/ra1028/DiffableDataSources/blob/maste
</article>
</div>
<section class="footer">
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-06-24)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 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>
</div>
+34 -18
View File
@@ -8,26 +8,41 @@ if (navigator.userAgent.match(/xcode/i)) {
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
var $link = $(`.token[href="${location.hash}"]`);
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
@@ -36,8 +51,9 @@ $(".token").click(function(event) {
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
+17 -9
View File
@@ -1,9 +1,4 @@
$(function(){
var searchIndex = lunr(function() {
this.ref('url');
this.field('name');
});
var $typeahead = $('[data-typeahead]');
var $form = $typeahead.parents('form');
var searchURL = $form.attr('action');
@@ -26,21 +21,34 @@ $(function(){
$form.addClass('loading');
$.getJSON(searchURL).then(function(searchData) {
$.each(searchData, function (url, doc) {
searchIndex.add({url: url, name: doc.name});
const searchIndex = lunr(function() {
this.ref('url');
this.field('name');
this.field('abstract');
for (const [url, doc] of Object.entries(searchData)) {
this.add({url: url, name: doc.name, abstract: doc.abstract});
}
});
$typeahead.typeahead(
{
highlight: true,
minLength: 3
minLength: 3,
autoselect: true
},
{
limit: 10,
display: displayTemplate,
templates: { suggestion: suggestionTemplate },
source: function(query, sync) {
var results = searchIndex.search(query).map(function(result) {
const lcSearch = query.toLowerCase();
const results = searchIndex.query(function(q) {
q.term(lcSearch, { boost: 100 });
q.term(lcSearch, {
boost: 10,
wildcard: lunr.Query.wildcard.TRAILING
});
}).map(function(result) {
var doc = searchData[result.ref];
doc.url = result.ref;
return doc;
Vendored Executable → Regular
+2 -4
View File
File diff suppressed because one or more lines are too long
Vendored Executable → Regular
+1 -6
View File
File diff suppressed because one or more lines are too long
+182 -46
View File
@@ -1,18 +1,18 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 1.2.0
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2017 Twitter, Inc. and other contributors; Licensed MIT
*/
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("typeahead.js", [ "jquery" ], function(a0) {
define([ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
@@ -148,6 +148,13 @@
stringify: function(val) {
return _.isString(val) ? val : JSON.stringify(val);
},
guid: function() {
function _p8(s) {
var p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return "tt-" + _p8() + _p8(true) + _p8(true) + _p8();
},
noop: function() {}
};
}();
@@ -189,7 +196,7 @@
function buildHtml(c) {
return {
wrapper: '<span class="' + c.wrapper + '"></span>',
menu: '<div class="' + c.menu + '"></div>'
menu: '<div role="listbox" class="' + c.menu + '"></div>'
};
}
function buildSelectors(classes) {
@@ -264,10 +271,8 @@
}
_.mixin(EventBus.prototype, {
_trigger: function(type, args) {
var $e;
$e = $.Event(namespace + type);
(args = args || []).unshift($e);
this.$el.trigger.apply(this.$el, args);
var $e = $.Event(namespace + type);
this.$el.trigger.call(this.$el, $e, args || []);
return $e;
},
before: function(type) {
@@ -384,7 +389,36 @@
tagName: "strong",
className: null,
wordsOnly: false,
caseSensitive: false
caseSensitive: false,
diacriticInsensitive: false
};
var accented = {
A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]",
B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]",
C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]",
D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]",
E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]",
F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]",
G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]",
H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]",
I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]",
J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]",
K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]",
L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]",
M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]",
N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]",
O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]",
P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]",
Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]",
R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]",
S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]",
T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]",
U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]",
V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]",
W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]",
X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]",
Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]",
Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]"
};
return function hightlight(o) {
var regex;
@@ -393,7 +427,7 @@
return;
}
o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive);
traverse(o.node, hightlightTextNode);
function hightlightTextNode(textNode) {
var match, patternNode, wrapperNode;
@@ -419,10 +453,17 @@
}
}
};
function getRegex(patterns, caseSensitive, wordsOnly) {
function accent_replacer(chr) {
return accented[chr.toUpperCase()] || chr;
}
function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) {
var escapedPatterns = [], regexStr;
for (var i = 0, len = patterns.length; i < len; i++) {
escapedPatterns.push(_.escapeRegExChars(patterns[i]));
var escapedWord = _.escapeRegExChars(patterns[i]);
if (diacriticInsensitive) {
escapedWord = escapedWord.replace(/\S/g, accent_replacer);
}
escapedPatterns.push(escapedWord);
}
regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
@@ -448,6 +489,14 @@
www.mixin(this);
this.$hint = $(o.hint);
this.$input = $(o.input);
this.$input.attr({
"aria-activedescendant": "",
"aria-owns": this.$input.attr("id") + "_listbox",
role: "combobox",
"aria-readonly": "true",
"aria-autocomplete": "list"
});
$(www.menu).attr("id", this.$input.attr("id") + "_listbox");
this.query = this.$input.val();
this.queryWhenFocused = this.hasFocus() ? this.query : null;
this.$overflowHelper = buildOverflowHelper(this.$input);
@@ -455,6 +504,7 @@
if (this.$hint.length === 0) {
this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
}
this.onSync("cursorchange", this._updateDescendent);
}
Input.normalizeQuery = function(str) {
return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
@@ -524,6 +574,9 @@
this.trigger("whitespaceChanged", this.query);
}
},
_updateDescendent: function updateDescendent(event, id) {
this.$input.attr("aria-activedescendant", id);
},
bind: function() {
var that = this, onBlur, onFocus, onKeydown, onInput;
onBlur = _.bind(this._onBlur, this);
@@ -647,6 +700,7 @@
"use strict";
var keys, nameGenerator;
keys = {
dataset: "tt-selectable-dataset",
val: "tt-selectable-display",
obj: "tt-selectable-object"
};
@@ -666,19 +720,20 @@
}
www.mixin(this);
this.highlight = !!o.highlight;
this.name = o.name || nameGenerator();
this.name = _.toStr(o.name || nameGenerator());
this.limit = o.limit || 5;
this.displayFn = getDisplayFn(o.display || o.displayKey);
this.templates = getTemplates(o.templates, this.displayFn);
this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source;
this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async;
this._resetLastSuggestion();
this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
}
Dataset.extractData = function extractData(el) {
var $el = $(el);
if ($el.data(keys.obj)) {
return {
dataset: $el.data(keys.dataset) || "",
val: $el.data(keys.val) || "",
obj: $el.data(keys.obj) || null
};
@@ -697,7 +752,7 @@
} else {
this._empty();
}
this.trigger("rendered", this.name, suggestions, false);
this.trigger("rendered", suggestions, false, this.name);
},
_append: function append(query, suggestions) {
suggestions = suggestions || [];
@@ -708,7 +763,7 @@
} else if (!this.$lastSuggestion.length && this.templates.notFound) {
this._renderNotFound(query);
}
this.trigger("rendered", this.name, suggestions, true);
this.trigger("rendered", suggestions, true, this.name);
},
_renderSuggestions: function renderSuggestions(query, suggestions) {
var $fragment;
@@ -749,7 +804,7 @@
_.each(suggestions, function getSuggestionNode(suggestion) {
var $el, context;
context = that._injectQuery(query, suggestion);
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
$el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
fragment.appendChild($el[0]);
});
this.highlight && highlight({
@@ -787,7 +842,7 @@
this.cancel = function cancel() {
canceled = true;
that.cancel = $.noop;
that.async && that.trigger("asyncCanceled", query);
that.async && that.trigger("asyncCanceled", query, that.name);
};
this.source(query, sync, async);
!syncCalled && sync([]);
@@ -800,16 +855,17 @@
rendered = suggestions.length;
that._overwrite(query, suggestions);
if (rendered < that.limit && that.async) {
that.trigger("asyncRequested", query);
that.trigger("asyncRequested", query, that.name);
}
}
function async(suggestions) {
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
that.async && that.trigger("asyncReceived", query);
var idx = Math.abs(rendered - that.limit);
rendered += idx;
that._append(query, suggestions.slice(0, idx));
that.async && that.trigger("asyncReceived", query, that.name);
}
}
},
@@ -843,7 +899,7 @@
suggestion: templates.suggestion || suggestionTemplate
};
function suggestionTemplate(context) {
return $("<div>").text(displayFn(context));
return $('<div role="option">').attr("id", _.guid()).text(displayFn(context));
}
}
function isValidName(str) {
@@ -884,10 +940,11 @@
this.trigger.apply(this, arguments);
},
_allDatasetsEmpty: function allDatasetsEmpty() {
return _.every(this.datasets, isDatasetEmpty);
function isDatasetEmpty(dataset) {
return dataset.isEmpty();
}
return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) {
var isEmpty = dataset.isEmpty();
this.$node.attr("aria-expanded", !isEmpty);
return isEmpty;
}, this));
},
_getSelectables: function getSelectables() {
return this.$node.find(this.selectors.selectable);
@@ -912,6 +969,12 @@
var that = this, onSelectableClick;
onSelectableClick = _.bind(this._onSelectableClick, this);
this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
this.$node.on("mouseover", this.selectors.selectable, function() {
that.setCursor($(this));
});
this.$node.on("mouseleave", function() {
that._removeCursor();
});
_.each(this.datasets, function(dataset) {
dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that);
});
@@ -921,9 +984,11 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
this.$node.attr("aria-expanded", false);
this.$node.removeClass(this.classes.open);
this._removeCursor();
},
@@ -988,6 +1053,55 @@
});
return Menu;
}();
var Status = function() {
"use strict";
function Status(options) {
this.$el = $("<span></span>", {
role: "status",
"aria-live": "polite"
}).css({
position: "absolute",
padding: "0",
border: "0",
height: "1px",
width: "1px",
"margin-bottom": "-1px",
"margin-right": "-1px",
overflow: "hidden",
clip: "rect(0 0 0 0)",
"white-space": "nowrap"
});
options.$input.after(this.$el);
_.each(options.menu.datasets, _.bind(function(dataset) {
if (dataset.onSync) {
dataset.onSync("rendered", _.bind(this.update, this));
dataset.onSync("cleared", _.bind(this.cleared, this));
}
}, this));
}
_.mixin(Status.prototype, {
update: function update(event, suggestions) {
var length = suggestions.length;
var words;
if (length === 1) {
words = {
result: "result",
is: "is"
};
} else {
words = {
result: "results",
is: "are"
};
}
this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate.");
},
cleared: function() {
this.$el.text("");
}
});
return Status;
}();
var DefaultMenu = function() {
"use strict";
var s = Menu.prototype;
@@ -1052,6 +1166,7 @@
this.input = o.input;
this.menu = o.menu;
this.enabled = true;
this.autoselect = !!o.autoselect;
this.active = false;
this.input.hasFocus() && this.activate();
this.dir = this.input.getLangDir();
@@ -1098,8 +1213,12 @@
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
_onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) {
this._updateHint();
if (this.autoselect) {
var cursorClass = this.selectors.cursor.substr(1);
this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass);
}
this.eventBus.trigger("render", suggestions, async, dataset);
},
_onAsyncRequested: function onAsyncRequested(type, dataset, query) {
@@ -1122,7 +1241,15 @@
_onEnterKeyed: function onEnterKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
if (this.select($selectable)) {
$e.preventDefault();
$e.stopPropagation();
}
} else if (this.autoselect) {
if (this.select(this.menu.getTopSelectable())) {
$e.preventDefault();
$e.stopPropagation();
}
}
},
_onTabKeyed: function onTabKeyed(type, $e) {
@@ -1144,12 +1271,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
@@ -1249,9 +1376,9 @@
},
select: function select($selectable) {
var data = this.menu.getSelectableData($selectable);
if (data && !this.eventBus.before("select", data.obj)) {
if (data && !this.eventBus.before("select", data.obj, data.dataset)) {
this.input.setQuery(data.val, true);
this.eventBus.trigger("select", data.obj);
this.eventBus.trigger("select", data.obj, data.dataset);
this.close();
return true;
}
@@ -1262,21 +1389,24 @@
query = this.input.getQuery();
data = this.menu.getSelectableData($selectable);
isValid = data && query !== data.val;
if (isValid && !this.eventBus.before("autocomplete", data.obj)) {
if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) {
this.input.setQuery(data.val);
this.eventBus.trigger("autocomplete", data.obj);
this.eventBus.trigger("autocomplete", data.obj, data.dataset);
return true;
}
return false;
},
moveCursor: function moveCursor(delta) {
var query, $candidate, data, payload, cancelMove;
var query, $candidate, data, suggestion, datasetName, cancelMove, id;
query = this.input.getQuery();
$candidate = this.menu.selectableRelativeToCursor(delta);
data = this.menu.getSelectableData($candidate);
payload = data ? data.obj : null;
suggestion = data ? data.obj : null;
datasetName = data ? data.dataset : null;
id = $candidate ? $candidate.attr("id") : null;
this.input.trigger("cursorchange", id);
cancelMove = this._minLengthMet() && this.menu.update(query);
if (!cancelMove && !this.eventBus.before("cursorchange", payload)) {
if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) {
this.menu.setCursor($candidate);
if (data) {
this.input.setInputValue(data.val);
@@ -1284,7 +1414,7 @@
this.input.resetInputValue();
this._updateHint();
}
this.eventBus.trigger("cursorchange", payload);
this.eventBus.trigger("cursorchange", suggestion, datasetName);
return true;
}
return false;
@@ -1322,7 +1452,7 @@
www = WWW(o.classNames);
return this.each(attach);
function attach() {
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor;
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor;
_.each(datasets, function(d) {
d.highlight = !!o.highlight;
});
@@ -1353,11 +1483,16 @@
node: $menu,
datasets: datasets
}, www);
status = new Status({
$input: $input,
menu: menu
});
typeahead = new Typeahead({
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength
minLength: o.minLength,
autoselect: o.autoselect
}, www);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
@@ -1450,7 +1585,7 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal));
});
return this;
}
@@ -1481,8 +1616,10 @@
});
}
function buildHintFromInput($input, www) {
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({
autocomplete: "off",
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({
readonly: true,
required: false
}).removeAttr("id name placeholder").removeClass("required").attr({
spellcheck: "false",
tabindex: -1
});
@@ -1495,7 +1632,6 @@
style: $input.attr("style")
});
$input.addClass(www.classes.input).attr({
autocomplete: "off",
spellcheck: false
});
try {
+1 -1
View File
File diff suppressed because one or more lines are too long