Skip to content

Commit 4944fec

Browse files
committed
improve documentation
1 parent 15156bd commit 4944fec

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Source/Collection/Modifier/CollectionCommonModifier.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class CollectionCommonModifier: Modifier<UICollectionView, CollectionItemAnimati
8787
///
8888
/// - parameter indexDictionary: dictionary where **key** is new section index and value is location of items to insert
8989
/// - parameter insertAnimation: animation of insert operation
90+
/// - Warning: make sure that you do not have mistake in indexes inside `indexDictionary`.
91+
/// For example, if you are inserting **many sections** using this method you should notice that **index** cannot be greater than **final number of sections**.
9092
override func insertSectionsAndRows(at indexDictionary: [Int: [IndexPath]],
9193
with insertAnimation: CollectionItemAnimation?) {
9294
guard let view = view else { return }

Source/Protocols/Modifier/Modifier.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ open class Modifier<View: UIView, Animation> {
6464
///
6565
/// - parameter indexDictionary: dictionary where **key** is new section index and value is location of subviews to insert
6666
/// - parameter insertAnimation: animation of insert operation
67+
/// - Warning: make sure that you do not have mistake in indexes inside `indexDictionary`.
68+
/// For example, if you are inserting **many sections** using this method you should notice that **index** cannot be greater than **final number of sections**.
6769
open func insertSectionsAndRows(at indexDictionary: [Int: [IndexPath]], with insertAnimation: Animation?) {
6870
preconditionFailure("\(#function) must be overriden in child")
6971
}

Source/Table/Modifier/TableCommonModifier.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class TableCommonModifier: Modifier<UITableView, UITableView.RowAnimation> {
8787
///
8888
/// - parameter indexDictionary: dictionary where **key** is new section index and value is location of subviews to insert
8989
/// - parameter insertAnimation: animation of insert operation
90+
/// - Warning: make sure that you do not have mistake in indexes inside `indexDictionary`.
91+
/// For example, if you are inserting **many sections** using this method you should notice that **index** cannot be greater than **final number of sections**.
9092
override func insertSectionsAndRows(at indexDictionary: [Int: [IndexPath]],
9193
with insertAnimation: UITableView.RowAnimation?) {
9294
guard let view = view else { return }
@@ -95,7 +97,6 @@ class TableCommonModifier: Modifier<UITableView, UITableView.RowAnimation> {
9597
let allValues = indexDictionary.values.flatMap { $0 }
9698
view?.insertSections(setOfKeys, with: insertAnimation ?? .none)
9799
view?.insertRows(at: allValues, with: insertAnimation ?? .none)
98-
99100
}
100101
}
101102

0 commit comments

Comments
 (0)