mardi 30 juillet 2019

How to get random value from struct

How to pick out random constant value from the struct?

struct randomMessage {

    static let message1 = "Message1"
    static let message2 = "Message2"
    static let message3 = "Message3"
    static let message4 = "Message4"
    static let message5 = "Message5"
}

the only way is all the values to array and pick the randomElement ?




Aucun commentaire:

Enregistrer un commentaire