IGListKit/Examples/Examples-macOS/IGListKitExamples/Models/User.swift
Nate Stedman f367b455a6 Properly split IGListDiffKit and IGListKit podspecs (#1385)
Summary:
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1385

I attempted to work the two frameworks into a single podspec, but it didn't really work that well. Instead, let's just split them into two podspec files - this should work fine, and more closely follows the Carthage/Xcode behavior.

This should address #1382. Note that the attached project does need to be edited, because we also need to manually specify the `IGListDiffKit` pod location. This issue will go away with the release of 4.0.

Reviewed By: iperry90

Differential Revision: D18449843

fbshipit-source-id: 2750aee1ba39d21b9f1b3521ea8911929ae728b1
2019-11-13 05:30:28 -08:00

40 lines
1.2 KiB
Swift

/**
Copyright (c) Facebook, Inc. and its affiliates.
The examples provided by Facebook are for non-commercial testing and evaluation
purposes only. Facebook reserves all rights not expressly granted.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import Foundation
import IGListDiffKit
final class User: ListDiffable {
let pk: Int
let name: String
init(pk: Int, name: String) {
self.pk = pk
self.name = name
}
// MARK: ListDiffable
func diffIdentifier() -> NSObjectProtocol {
return pk as NSObjectProtocol
}
func isEqual(toDiffableObject object: ListDiffable?) -> Bool {
guard self !== object else { return true }
guard let object = object as? User else { return false }
return name == object.name
}
}