Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MeetupId.Shoulds.swift 1.0KB

11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
11 maanden geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import Foundation
  2. public extension MeetupId {
  3. static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? {
  4. guard !c.isLoading.value else { return nil }
  5. if
  6. c.textUI.isRecent,
  7. let sid = formatId(c.textUI.value)
  8. {
  9. return sid.count > 2
  10. }
  11. if c.join {
  12. return false
  13. }
  14. if
  15. c.isLoading.isRecent,
  16. !c.isLoading.value
  17. {
  18. return true
  19. }
  20. return nil
  21. }
  22. static func shouldFinishLoading(_ c: MeetupIdContext) -> Bool? {
  23. guard
  24. c.isLoading.isRecent,
  25. c.isLoading.value
  26. else {
  27. return nil
  28. }
  29. return true
  30. }
  31. static func shouldResetLoading(_ c: MeetupIdContext) -> Bool? {
  32. if
  33. c.join,
  34. !c.isLoading.value
  35. {
  36. return true
  37. }
  38. if
  39. c.finishLoading,
  40. c.isLoading.value
  41. {
  42. return false
  43. }
  44. return nil
  45. }
  46. static func shouldResetText(_ c: MeetupIdContext) -> String? {
  47. guard c.textUI.isRecent else { return nil }
  48. return formatId(c.textUI.value)
  49. }
  50. }