Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created September 2, 2018 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/e68f436e7eee6ba8b4de715e9b2f3185 to your computer and use it in GitHub Desktop.
Save fitomad/e68f436e7eee6ba8b4de715e9b2f3185 to your computer and use it in GitHub Desktop.
public enum DatosPersonales: CaseIterable {
    case nombre
    case apellidos
    case direccion
    case telefonoMovil
    case telefonoFijo
}
print("Puede establecer \(DatosPersonales.allCases.count) campos")
for datoPersonal in DatosPersonales.allCases
{
    print(datoPersonal)
}
/*
 apellidos
 direccion
 telefonoMovil
 telefonoFijo
*/
let descripcion = DatosPersonales.allCases.map({ "\($0)" }).joined(separator: ", ")
print(descripcion)
/*
 nombre, apellidos, direccion, telefonoMovil, telefonoFijo
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment