Sender.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. MIT License
  3. Copyright (c) 2017-2018 MessageKit
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all
  11. copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18. SOFTWARE.
  19. */
  20. import Foundation
  21. /// An object that groups the metadata of a messages sender.
  22. public struct Sender {
  23. /// MARK: - Properties
  24. /// The unique String identifier for the sender.
  25. ///
  26. /// Note: This value must be unique across all senders.
  27. public let id: String
  28. /// The display name of a sender.
  29. public let displayName: String
  30. // MARK: - Intializers
  31. public init(id: String, displayName: String) {
  32. self.id = id
  33. self.displayName = displayName
  34. }
  35. }
  36. // MARK: - Equatable Conformance
  37. extension Sender: Equatable {
  38. /// Two senders are considered equal if they have the same id.
  39. public static func == (left: Sender, right: Sender) -> Bool {
  40. return left.id == right.id
  41. }
  42. }