https://github.com/devxoul/Carte
🍴 Open source license notice view generator for Swift
https://github.com/devxoul/Carte
generator ios license oss swift
Last synced: about 2 months ago
JSON representation
🍴 Open source license notice view generator for Swift
- Host: GitHub
- URL: https://github.com/devxoul/Carte
- Owner: devxoul
- License: mit
- Created: 2015-08-03T16:33:12.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T03:59:47.000Z (almost 5 years ago)
- Last Synced: 2025-03-31T11:21:09.877Z (3 months ago)
- Topics: generator, ios, license, oss, swift
- Language: Ruby
- Homepage:
- Size: 550 KB
- Stars: 188
- Watchers: 4
- Forks: 23
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# La Carte

[](https://cocoapods.org/pods/Carte)
[](https://travis-ci.org/devxoul/Carte)
[](https://codecov.io/gh/devxoul/Carte)An open source license notice view generator for Swift.
## Screenshot

> ⬆ Those view controllers are automatically generated ✨
## Features
- **🚗 Automatic:** Carte automatically generates OSS notice from [CocoaPods](https://cocoapods.org).
- **☕️ Easy Integration:** Install Carte and push CarteViewController. It's all done.
- **🎨 Customizable:** Adding custom items, customizing CarteViewController. See [Customizing](#customizing) section.## Installation
Carte only supports [CocoaPods](https://cocoapods.org) at this time.
```ruby
pod 'Carte'
```**⚠️ IMPORTANT**: Don't forget to add the post install hook to your Podfile. Add this script to the end of your Podfile:
```ruby
post_install do |installer|
pods_dir = File.dirname(installer.pods_project.path)
at_exit { `ruby #{pods_dir}/Carte/Sources/Carte/carte.rb configure` }
end
```## Usage
Carte provides `CarteViewController`. You can use it as a normal view controller. Push, present or do whatever you want.
```swift
let carteViewController = CarteViewController()
```If you want to create your own UI, use `Carte.items` to get `CarteItem`s.
```swift
class Carte {
static var items: [CarteItem]
}
```## Customizing
### Custom Items
`CarteViewController` has a property named `items` which is an array of `CarteItem`. All of the licenses are stored in the `items`. You can add new items, remove existings, or sort items by manipulating `items` array.
This is an example of adding a new `CarteItem` and sorting items.
```swift
var item = CarteItem(name: "Carte")
item.licenseText = "The MIT License (MIT) ...Very long text..."let carteViewController = CarteViewController()
carteViewController.items.append(item)
carteViewController.items.sort { $0.name < $1.name }
```### Customizing View Controllers
`CarteDetailViewController` is presented when user selects a table view cell. `CarteViewController` provides a handler for customizing it.
Definition:
```swift
var configureDetailViewController: (CarteDetailViewController -> Void)?
```Example:
```swift
let carteViewController = CarteViewController()
carteViewController.configureDetailViewController = { detailViewController in
detailViewController.navigationItem.leftBarButtonItem = ...
print(detailViewController.carteItem.name)
}
```## License
Carte is under MIT license. See the [LICENSE](LICENSE) file for more info.