Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Matching Optional


enum Occupation: String {
  case AppSo = "app"
  case Number = "number"

let typeString = "mindStore"

switch Occupation(rawValue: typeString) {

  case .AppSo?:
    print("AppSo Article")

  case .Number?:
    print("Number Article")

  case nil:

抽取于:Matching with Swift's Optional Pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.