zoukankan      html  css  js  c++  java
  • 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)

  • 相关阅读:
    github和bitbucket
    shell 删除文件下的* (copy).jpg备份文件
    linux 的iptables防火墙
    yum使用本地源
    linux的vnc- rdesktop远程登录windows桌面
    httpd/php/mysql的安装-1
    linux下的视频音频播放器终极解决方案
    linux读写ntfs
    示波器和三极管
    电子技术中的dB
  • 原文地址:https://www.cnblogs.com/dhui69/p/11158949.html
Copyright © 2011-2022 走看看