This is my very first attempt at writing something that would generate fake data like firstname, lastname, email, internet domain name... It's far from finished BUT since I'm starting to dig the whole experimenting in the open thing... here we go.
It's heavily inspired by the awesome fzaninotto/Faker, I shamelessly borrowed his firstnames and lastnames for now.
let g = Generator.generator()
for _ in 0..<5 {
print(g["firstname"])
print(g["lastname"])
print(g["email"])
print(g["domain"])
}
Jordan
Cox
[email protected]
yahoo.com
Joe
Cook
[email protected]
gmail.com
Christian
Lewis
[email protected]
gmail.org
Aiden
Mitchell
[email protected]
supercorp.com
Harvey
Chapman
[email protected]
gmail.org
- Is the API nice enough? I like the subscript approach but subscript in Swift 2.0 can't throw so...
- Right now the
Email
provider depends on the domain, the firstname and the lastname one but it's not obvious and I think there should be some kind of explicit dependency. - Generating things other than
String
, I've heard a group of Generics feeling lonely, π’ing in a corner.
I'm Palleas on twitter (and pretty much everywhere else), you can also open an issue.
π