-
Notifications
You must be signed in to change notification settings - Fork 182
/
README.md.orig
executable file
·309 lines (230 loc) · 8.44 KB
/
README.md.orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
![Fakery logo](https://raw.githubusercontent.com/vadymmarkov/Fakery/master/Images/logo.png)
[![CI Status](http://img.shields.io/travis/vadymmarkov/Fakery.svg?style=flat)](https://travis-ci.org/vadymmarkov/Fakery)
[![Version](https://img.shields.io/cocoapods/v/Fakery.svg?style=flat)](http://cocoadocs.org/docsets/Fakery)
[![License](https://img.shields.io/cocoapods/l/Fakery.svg?style=flat)](http://cocoadocs.org/docsets/Fakery)
[![Platform](https://img.shields.io/cocoapods/p/Fakery.svg?style=flat)](http://cocoadocs.org/docsets/Fakery)
This is a Swift port of Ruby's [Faker](https://github.com/stympy/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.
## Table of Contents
* [Usage](#usage)
* [Localization](#localization)
* [Generators](#generators)
* [Address](#address)
* [App](#app)
* [Business](#business)
* [Cat](#cat)
* [Commerce](#commerce)
* [Company](#company)
* [Zelda](#zelda)
* [Gender](#gender)
* [Internet](#internet)
* [Lorem](#lorem)
* [Name](#name)
* [Number](#number)
* [Phone number](#phone-number)
* [Team](#team)
* [Bank](#bank)
* [Car](#car)
* [Programming language](#programming-language)
* [Vehicle](#vehicle)
* [Ham](#ham)
* [House](#house)
* [Installation](#installation)
* [Contributing](#contributing)
* [Author](#author)
* [License](#license)
## Usage
```swift
let faker = Faker(locale: "nb-NO")
let firstName = faker.name.firstName() //=> "Emilie"
let lastName = faker.name.lastName() //=> "Hansen"
let city = faker.address.city() //=> "Oslo"
```
## Localization
**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!
The default locale is English. When you use one of the available generators and
the corresponding key is not found in a JSON file for the currently selected
locale **Fakery** will also check if it exists in "en.json" file.
## Generators
### Address
```swift
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.county() //=> "Autauga County"
faker.address.country() //=> "United States of America"
faker.address.countryCode() //=> "US"
faker.address.latitude() //=> -58.17256227443719
faker.address.longitude() //=> -156.65548382095133
faker.address.coordinate() //=> CLLocationCoordinate2D(latitude: 40.97868, longitude: 29.09306)
```
### App
```swift
faker.app.name() //=> "Namfix"
faker.app.version() //=> "0.1.1"
faker.app.author() //=> "Ida Adams"
```
### Business
```swift
faker.business.creditCardNumber() //=> "1234-2121-1221-1211"
faker.business.creditCardType() //=> "visa"
faker.business.creditCardExpiryDate() //=> "2020-10-12"
```
### Cat
```swift
faker.cat.name() //=> "Shadow"
faker.cat.breed() //=> "British Semipi-longhair"
faker.cat.registry() //=> "American Cat Fanciers Association"
```
### Commerce
```swift
faker.commerce.color() //=> "black"
faker.commerce.department(maximum: Int, fixedAmount: Bool) //=> "Music"
faker.commerce.productName() //=> "Awesome Wooden Hat"
faker.commerce.price() // 90.5
```
### Company
```swift
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"
```
### Zelda
```swift
faker.zelda.game() //=> "Ocarina of Time"
```
### Gender
```swift
faker.gender.type() //=> "Agender"
faker.gender.binaryType() //=> "Male"
```
### Internet
```swift
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.internet.hashtag() //=> "#art"
```
### Lorem
```swift
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
```
### Name
```swift
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"
```
### Number
```swift
faker.number.randomBool() //=> true or false
faker.number.randomInt() //=> some Int between 0 and 1000
faker.number.randomInt(min: -100, max:50) //=> some Int between -100 and 50
faker.number.randomFloat() //=> some Float between 0 and 1000
faker.number.randomFloat(min: -10.4, max:50) //=> some Float between -10.4 and 50
faker.number.randomCGFloat() //=> some CGFloat between 0 and 1000
faker.number.randomCGFloat(min: 42.42, max:86) //=> some CGFloat between -42.42 and 86
faker.number.randomDouble() //=> some Double between 0 and 1000
faker.number.randomDouble(min: 0, max:1) //=> some Double between 0 and 1
faker.number.increasingUniqueId() //=> every call returns an unique int
```
### Phone number
```swift
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"
```
### Team
```swift
faker.team.name() //=> "bats"
faker.team.creature() //=> "Alabama bats"
faker.team.state() // => "Alabama"
```
### Bank
```swift
faker.bank.name() //=> "ABN AMRO CORPORATE FINANCE LIMITED"
faker.bank.swiftBic() //=> "AAFMGB21"
faker.bank.iban() // => "NL45BUNQ2209931378"
faker.bank.bban() //=> ABNA0136468471
```
### Hobbit
```swift
faker.hobbit.character() //=> "Bilbo Baggins"
faker.hobbit.thorinsCompany() //=> "Thorin Oakenshield"
faker.hobbit.quote() // => "Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?"
faker.hobbit.location() //=> "Bree"
```
### Car
```swift
faker.car.brand() //=> "BMW"
```
### Programming language
```swift
faker.programming_language.name() //=> "Elixir"
faker.programming_language.creator() //=> "José Valim"
```
### Vehicle
```swift
faker.vehicle.manufacture() //=> "Volkswagen"
faker.vehicle.make() //=> "BMW"
faker.vehicle.colors() //=> "Red"
```
### Ham
```swift
faker.ham.name() //=> "Taylor Ham"
```
### House
```swift
faker.house.furniture() //=> "chair"
faker.house.room() //=> "living room"
```
## Installation
**Fakery** is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'Fakery'
```
## Contributing
Please see our [playbook](https://github.com/hyperoslo/playbook/blob/master/GIT_AND_GITHUB.md) for guidelines on contributing.
## Author
Vadym Markov, [email protected]
## License
**Fakery** is available under the MIT license. See the LICENSE file for more info.