https://github.com/digipolitan/polymorph-core
https://github.com/digipolitan/polymorph-core
models polymorph swift
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/digipolitan/polymorph-core
- Owner: Digipolitan
- License: bsd-3-clause
- Created: 2017-06-14T22:04:29.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-06T22:03:28.000Z (over 6 years ago)
- Last Synced: 2025-01-17T00:20:11.030Z (4 months ago)
- Topics: models, polymorph, swift
- Language: Swift
- Size: 48.8 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
PolymorphCore
=================================[](https://developer.apple.com/swift/)
[](https://swift.org/package-manager/)
[](http://twitter.com/Digipolitan)Core models to the [PolymorphCore](https://github.com/Digipolitan/polymorph-cli) project
## Installation
### SPM
To install PolymorphCore with SwiftPackageManager, add the following lines to your `Package.swift`.
```swift
let package = Package(
name: "XXX",
products: [
.library(
name: "XXX",
targets: ["XXX"]),
],
dependencies: [
.package(url: "https://github.com/Digipolitan/polymorph-core.git", from: "1.1.0")
],
targets: [
.target(
name: "XXX",
dependencies: ["PolymorphCore"])
]
)
```## The Basics
```swift
guard let package = try? Package(string: "com.digipolitan.sample"),
let userPackage = try? Package(string: "user") else {
return
}
let project = Project(name: "Sample", package: package)
project.models.addClass(.init(name: "User", package: userPackage))let encoder = JSONEncoder()
if let data = try? encoder.encode(project),
let json = String(data: data, encoding: .utf8) {
print(json) // Print project as JSON
}
```## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details!
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report
unacceptable behavior to [[email protected]](mailto:[email protected]).## License
PolymorphCore is licensed under the [BSD 3-Clause license](LICENSE).