enum Suit {
  case spades, hearts, diamonds, clubs
  var icon: Character {
    switch self {
    case .spades:
      return "♤"
    case .hearts:
      return "♡"
    case .diamonds:
      return "♢"
    case .clubs:
      return "♧"
    }
  }
}

enum Rank: CaseIterable {
  case ace
  case two, three, four, five, six, seven, eight, nine, ten
  case jack, queen, king
  var icon: String {
    switch self {
    case .ace:
      return "A"
    case .two:
      return "2"
    case .three:
      return "3"
    case .four:
      return "4"
    case .five:
      return "5"
    case .six:
      return "6"
    case .seven:
      return "7"
    case .eight:
      return "8"
    case .nine:
      return "9"
    case .ten:
      return "10"
    case .jack:
      return "J"
    case .queen:
      return "Q"
    case .king:
      return "K"
    }
  }
}

for suit in [Suit.clubs, .diamonds, .hearts, .spades] {
  for rank in Rank.allCases {
    print("\(rank.icon)\(suit.icon)")
  }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: