Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Added labels equatable check to ListDiffable isEqual method #716

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Classes/Models/RepositoryLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import IGListKit

final class RepositoryLabel: ListDiffable {
final class RepositoryLabel: ListDiffable, Equatable {

let color: String
let name: String
Expand All @@ -30,5 +30,12 @@ final class RepositoryLabel: ListDiffable {
guard let object = object as? RepositoryLabel else { return false }
return color == object.color
}

//MARK: Equatable

static func ==(lhs: RepositoryLabel, rhs: RepositoryLabel) -> Bool {
return lhs.name == rhs.name
&& lhs.color == rhs.color
}

}
1 change: 1 addition & 0 deletions Classes/Repository/RepositoryIssueSummaryModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ class RepositoryIssueSummaryModel: ListDiffable {
&& author == object.author
&& created == object.created
&& title.attributedText.string == object.title.attributedText.string
&& labels == object.labels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this check is O(n) (comparing all contents of an array). I'm going to clean this up to be much faster.

}
}