• Swift 枚举enum


    enum methodType{

        case get

        case post

        case put

        case delete

    }

     

    枚举赋值

    enum methodType:String{

        case get="get"

        case post="post"

        case put="put"

        case delete="delete"

    }

     

    let type:methodType = .get

    let type2 = methodType.post

    let type3 = methodType(rawValue: "put")// 返回一个可选类型 值/nil

    let str=type3?.rawValue//打印字符串 "put"

     

    print(type)

     

    //省略写法

    enum Direction:Int{

        case east=0,west,north,south

    }

    print(Direction.north)

  • 相关阅读:
    Oracle日期周具体解释以及周開始结束时间计算
    getActivity nullPointerException
    dTree无限级文件夹树和JQuery同步Ajax请求
    按键精灵微信群内加好友
    QPS、RT、PV、UV之间的关系
    [简谈]绕过HR破门而入的求职智慧
    Mina、Netty、Twisted一起学(十):线程模型
    ubuntu查看硬件信息
    openstack API debug OpenstackEveryProject_CLI,curl_based
    openstack configure
  • 原文地址:https://www.cnblogs.com/dhui69/p/11158949.html
Copyright © 2020-2023  润新知