Sample — object instance with fake data used for testing. This Xcode Source Editor Extension will generate Swift samples based on object declarations. Handy if you have a rather complex model type with nested structs and you have to write a lot of boilerplate code.
Open a file with models that should have samples
struct Model {
enum Variant {
case first
case second
}
struct Nested {
let identifier: String
let amount: Int
}
let identifier: String
let name: String
let nested: Nested
let variant: Variant
}
Run the extension's Generate
and all the samples will be generated. All you need now is to fill samples with default values
- Open
SampleGenerator.xcodeproj
- Enable target signing for both the Application and the Source Editor Extension using your own developer ID
- Product > Archive
- Right click archive > Show in Finder
- Right click archive > Show Package Contents
- Drag
SampleGenerator.app
to your Applications folder - Run
SampleGenerator.app
- Go to System Preferences -> Extensions -> Xcode Source Editor and enable the extension
- The menu item should now be available from Xcode's Editor menu