Skip to content

Commit

Permalink
Add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Aug 20, 2017
1 parent aa4cbac commit 94aba9b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/DataSources/DataController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ public final class DataController<A: Updating> {
public func add<T>(section: Section<T>) {
assertMainThread()

precondition(
{
if case .initialized = $0.state {
return true
}
return false
}(section),
"Section \(section) has already added."
)

let _section = sectionDataControllers.count
section.state = .added(at: _section)

Expand Down

0 comments on commit 94aba9b

Please sign in to comment.