Advanced Java enums in Swift

后端 未结 5 955
萌比男神i
萌比男神i 2021-01-03 15:40

I have a number of Java classes I need to convert to Swift code. One of the classes has an advanced enum:

public enum Student {

  STUDENT_ONE(\"Steve\", \"J         


        
5条回答
  •  再見小時候
    2021-01-03 16:22

    This is what I ended up doing - not sure about this at all:

    struct Students {
    
        enum Students {
            case STUDENT_ONE(String, String)
            case STUDENT_TWO(String, String)
        }
    
        let STUDENT_ONE = Students.STUDENT_ONE("Steve", "Jobs")
        let STUDENT_TWO = Students.STUDENT_TWO("Steve", "Two")
    }
    

提交回复
热议问题