This is a Swift port of Ruby's Faker library that generates fake data.
Are you still bothered with meaningless randomly character strings? Just relax and leave this job to Fakery. It's useful in all the cases when you need to use some dummy data for testing, population of database during development, etc.
NOTE: Generated data is pretty realistic, supports a range of locales, but returned values are not guaranteed to be unique.
let faker = Faker(locale: "nb-NO")
let firstName = faker.name.firstName() //=> "Emilie"
let lastName = faker.name.lastName() //=> "Hansen"
let city = faker.address.city() //=> "Oslo"
Fakery is quite powerful when it comes to generation of locale-specific data.
In Resources/Locales
you can find JSON files for more than 20 locales, and, of course, it's not a limit.
Feel free to contribute and add more!
faker.address.city() //=> "Oslo"
faker.address.streetName() //=> "North Avenue"
faker.address.secondaryAddress() //=> "Apt. 123"
faker.address.streetAddress(includeSecondary: Bool) //=> "12 North Avenue"
faker.address.buildingNumber() //=> "123"
faker.address.postcode(stateAbbreviation: String) //=> "0884"
faker.address.timeZone() //=> "America/Los_Angeles"
faker.address.streetSuffix() //=> "Avenue"
faker.address.citySuffix() //=> "town"
faker.address.cityPrefix() //=> "North"
faker.address.stateAbbreviation() //=> "CA"
faker.address.state() //=> "California"
faker.address.country() //=> "United States of America"
faker.address.countryCode() //=> "US"
faker.address.latitude() //=> -58.17256227443719
faker.address.longitude() //=> -156.65548382095133
faker.app.name() //=> "Namfix"
faker.app.version() //=> "0.1.1"
faker.app.author() //=> "Ida Adams"
faker.business.creditCardNumber() //=> "1234-2121-1221-1211"
faker.business.creditCardType() //=> "visa"
faker.business.creditCardExpiryDate() //=> "2020-10-12"
faker.commerce.color() //=> "black"
faker.commerce.department(maximum: Int, fixedAmount: Bool) //=> "Music"
faker.commerce.productName() //=> "Awesome Wooden Hat"
faker.commerce.price() // 90.5
faker.company.name() //=> "Adams Inc"
faker.company.suffix() //=> "Inc"
faker.company.catchPhrase() //=> "Universal software"
faker.company.bs() //=> "implement innovative methodologies"
faker.company.logo() // "http://pigment.github.io/fake-logos/logos/medium/color/1.png"
faker.internet.username(separator: String?) //=> "ida4"
faker.internet.domainName(alphaNumericOnly: Bool) //=> "example.com"
faker.internet.domainWord(alphaNumericOnly: Bool) //=> "domainword"
faker.internet.domainSuffix() //=> "com"
faker.internet.email() // => "[email protected]"
faker.internet.freeEmail() //=> "gmail.com"
faker.internet.safeEmail() //=> "[email protected]"
faker.internet.password(minimumLength: Int, maximumLength: Int) //=> "e2dddhwd1g5qhvhgfi"
faker.internet.ipV4Address() //=> "24.29.18.175"
faker.internet.ipV6Address() //=> "ac5f:d696:3807:1d72:2eb5:4e81:7d2b:e1df"
faker.internet.url() //=> "http://example.com/ida4"
faker.internet.image() //=> "http://lorempixel.com/320/200"
faker.internet.templateImage() //=> "http://dummyimage.com/320x200/000000/ffffff"
faker.lorem.word() //=> "repellendus"
faker.lorem.words(amount: Int) //=> ["dolores", "adipisci", "nesciunt"]
faker.lorem.character() //=> "a"
faker.lorem.characters(amount: Int) // Default = 255
faker.lorem.sentence(wordsAmount: Int) // Default = 4
faker.lorem.sentences(amount: Int) // Default = 3
faker.lorem.paragraph(sentencesAmount: Int) // Default = 3
faker.lorem.paragraphs(amount: Int) // Default = 3
faker.name.name() //=> "Ida Adams"
faker.name.firstName() //=> "Ida"
faker.name.lastName() //=> "Adams"
faker.name.prefix() //=> "Mrs."
faker.name.suffix() //=> "PhD"
faker.name.title() //=> "Lead"
faker.phoneNumber.phoneNumber() //=> "1-333-333-3333"
faker.phoneNumber.cellPhone() //=> "333-333-3333"
faker.phoneNumber.areaCode() //=> "201"
faker.phoneNumber.exchangeCode() //=> "201"
faker.phoneNumber.subscriberNumber() //=> "1234"
faker.phoneNumber.numberExtension(length: Int) // "123"
faker.team.name() //=> "bats"
faker.team.creature() //=> "Alabama bats"
faker.team.state() // => "Alabama"
Fakery is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Fakery'
Please see our playbook for guidelines on contributing.
Vadym Markov, [email protected]
Fakery is available under the MIT license. See the LICENSE file for more info.