Skip to content

Instantly share code, notes, and snippets.

@JWPapi
Created December 5, 2019 00:09
Show Gist options
  • Save JWPapi/c0aa4a45360bfac85c144091b83de1d0 to your computer and use it in GitHub Desktop.
Save JWPapi/c0aa4a45360bfac85c144091b83de1d0 to your computer and use it in GitHub Desktop.
where to put users.count
if users.count > 0 {
if friendAttendees.count > 0 {
attendeesString.append(getYouOrFriendString(uid: friendAttendees[0].uid!, userName: friendAttendees[0].name))
}
if friendAttendees.count > 1 {
attendeesString.append(getYouOrFriendString(uid: friendAttendees[1].uid!, userName: friendAttendees[1].name))
}
if strangerAttendeeCount > 0 {
attendeesString.append(NSMutableAttributedString(string: " and \(strangerAttendeeCount) other"))
}
if strangerAttendeeCount > 0 && friendAttendees.count == 0 {
let userCase = strangerAttendeeCount > 1 ? "users" : "user"
attendeesString.append(NSMutableAttributedString(string: "\(strangerAttendeeCount) \(userCase)", attributes: [
.font: UIFont.systemFont(ofSize:16),
.foregroundColor: UIColor.lightGray
] as [NSAttributedString.Key: Any]))
}
attendeesString.append(NSMutableAttributedString(string: " booked a table.", attributes: [
.font: UIFont.systemFont(ofSize:16),
.foregroundColor: UIColor.lightGray
] as [NSAttributedString.Key: Any]
))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment