Giter Club home page Giter Club logo

carte's Introduction

Carte

Swift CocoaPods

Open source license notice view generator for Cocoa.

Screenshot

carte

These are the screenshots of demo project which is located in CarteDemo directory.

Features

  • ๐Ÿš— Automatic: Carte automatically generates OSS notice from CocoaPods and CocoaSeeds.
  • โ˜• Easy Integration: Install Carte, add run scripts, then push CarteViewController. It's done.
  • โœจ Customizable: Adding custom items, customizing CarteViewController. See Customizing section.

Getting Started

Step 1. Installation

  • For iOS 8+ projects: Use CocoaPods with Podfile:

    pod 'Carte', '~> 1.0'
  • For iOS 7 projects: I recommend you to try CocoaSeeds, which uses source code instead of dynamic frameworks. Sample Seedfile:

    github 'devxoul/Carte', '1.0.0', :files => 'Carte/*.{swift,rb}'

Step 2. Adding Run Scripts

phase-order

Carte has a simple ruby script named carte.rb that reads third-party libraries from CocoaPods and CocoaSeeds directory. You have to add 2 run script phases before and after 'Copy Bundle Resources' phase.

  • Carte Pre

      ruby /path/to/carte.rb pre
      
  • Carte Post

      ruby /path/to/carte.rb post
      
  • /path/to/carte.rb: carte.rb file is located in Carte directory.

    If you installed Carte via:

    • CocoaPods, then path would be: ${SRCROOT}/Pods/Carte/Carte/carte.rb
    • CocoaSeeds, then path would be: ${SRCROOT}/Seeds/Carte/Carte/carte.rb
  • For example (CocoaPods):

    carte-pre

Step 3. Using CarteViewController

Almost done! What you need to do now is using CarteViewController. Use it just like using a UIViewController: push, present, or whatever you want to do.

let carteViewController = CarteViewController()

Customizing

Manipulating items

CarteViewController has a property named items which is an array of CarteItem. All of licenses are stored in 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.

let item = CarteItem()
item.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 appeared when select a cell of table view. CarteViewController provides a handler for customizing it.

Definition:

var configureDetailViewController: (CarteDetailViewController -> Void)?

Example:

let carteViewController = CarteViewController()
carteViewController.configureDetailViewController = { detailViewController in
    detailViewController.navigationItem.leftBarButtonItem = ...
    print(detailViewController.carteItem!.name)
}

License

Carte is under MIT license. See the LICENSE file for more info.

carte's People

Contributors

devxoul avatar kimdarren avatar

Watchers

James Cloos avatar Jaewon Noh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.