https://github.com/eneskaraosman/loremswiftify
LoremSwiftify is a Macro that creates lorem ipsum data for your models
https://github.com/eneskaraosman/loremswiftify
code-generation ios lorem-ipsum lorem-ipsum-generator macros no-boiler swift swift-macros swift-package-manager swift-syntax
Last synced: about 1 year ago
JSON representation
LoremSwiftify is a Macro that creates lorem ipsum data for your models
- Host: GitHub
- URL: https://github.com/eneskaraosman/loremswiftify
- Owner: EnesKaraosman
- Created: 2024-03-23T10:04:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-02T23:20:57.000Z (over 1 year ago)
- Last Synced: 2025-05-03T22:35:35.823Z (about 1 year ago)
- Topics: code-generation, ios, lorem-ipsum, lorem-ipsum-generator, macros, no-boiler, swift, swift-macros, swift-package-manager, swift-syntax
- Language: Swift
- Homepage:
- Size: 65.4 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# LoremSwiftify
### Features
- [X] Support class (nesting is supported as well)
- [X] Support struct (nesting is supported as well)
- [X] Support enum (nesting is supported as well)
- [X] Support commonly used types
- [X] String
- [X] Int, Int8, Int16, Int32, Int64
- [X] UInt, UInt8, UInt16, UInt32, UInt64
- [X] Double, Float
- [X] Bool
- [X] Array
- [X] Dictionary
- [X] Optional
- [X] Date
- [X] URL
- [X] Color
- [X] Custom types supported if it's annotated with macro or confirms `LoremIpsumize` protocol
- [ ] Add #if DEBUG
- [X] Create Example SwiftUI project to demonstrate package usage for previews
- [X] Provide a way to customize lorem in different categories (like creditCard, phoneNumber, name, price etc..) (works for auto generated init)
- [ ] Provide a way to customize loreming for the supported built-in types (to completely determine what to receive for the lorem data)
- [ ] Implement unit test
---
See example project
[Example](Example/Example)
---
- Annotate any struct, class or enum with `@LoremSwiftify`
Then use `StructName.lorem()` or `ClassName.lorem()` or `EnumName.lorem()`. Basically `.lorem()` everywhere :)
```swift
extension ContentView {
@LoremSwiftify
struct Display {
let developers: [Developer]
@LoremSwiftify
struct Developer: Identifiable {
let id: String = UUID().uuidString
@Lorem(.string(.name))
let name: String
@Lorem(.string(.email))
let email: String
@Lorem(.string(.phoneNumber))
let phoneNumber: String
@Lorem(.url(.image))
let imageURL: URL
@Lorem(.url(.website))
let profileURL: URL
}
}
}
#Preview {
ContentView(display: .lorem())
}
```