2013年2月7日 星期四

how to create and submit a cocoapod.

1. to create a new podspec file (to create MyPod.podspec for example)

     $ pod spec create MyPod

2. modify MyPod.podspec to fit your need.
3. link it before sumbit

     $ pod spec lint MyPod.podspec

4. submit to repository using follow spec.

quoted from URL:http://nsscreencast.com/episodes/28-creating-a-cocoapod


  1. Fork the repository at http://github.com/CocoaPods/Specs.git
  2. Add your podspec file to its own versioned folder
  3. Push to your fork
  4. Issue a Pull Request

5. if you want to put pod on your own repository. refer to following URL:

https://github.com/CocoaPods/CocoaPods/wiki/Sharing-pod-specifications-with-yourself-and-the-world

test APIs on CocoaPods as well, first one is SVProgressHUD

//https://github.com/samvermette/SVProgressHUD // Podfile platform :ios pod 'JSONKit', '~> 1.4' pod 'Reachability', '~> 3.1.0' pod 'InAppSettingsKit', '~> 1.0' pod 'AFNetworking', '~> 0.10.1' pod 'GDataXML-HTML', '~> 1.0.0' pod 'SVProgressHUD', '~> 0.9' // it can show image as well. //+ (void)showImage:(UIImage*)image status:(NSString*)string; // use 28x28 white pngs //SVProgressHUD in .h - (IBAction)show; - (IBAction)showWithStatus; - (IBAction)dismiss; - (IBAction)dismissSuccess; - (IBAction)dismissError; //SVProgressHUD in .m #import "SVProgressHUD.h" //@implementation KATDetailViewController //{ NSTimer *timer; //} #pragma mark - Show Methods Sample - (void)show { [SVProgressHUD show]; } - (void)showWithStatus { [SVProgressHUD showWithStatus:@"Doing Stuff"]; } static float progress = 0.0f; - (void)showWithProgress:(id)sender { progress = 0.0f; [SVProgressHUD showProgress:0 status:@"Loading"]; if (timer) { [timer invalidate]; } timer = [NSTimer scheduledTimerWithTimeInterval:0.3f target:self selector:@selector(setProgress) userInfo:nil repeats:YES]; } - (void)setProgress { progress+=0.1f; [SVProgressHUD showProgress:progress status:@"Loading"]; if(progress >= 1.0f) { [timer invalidate]; timer = nil; [self performSelector:@selector(dismiss) withObject:nil afterDelay:0.4f]; } } #pragma mark - Dismiss Methods Sample - (void)dismiss { [SVProgressHUD dismiss]; [timer invalidate]; } - (void)dismissSuccess { [SVProgressHUD showSuccessWithStatus:@"Great Success!"]; [timer invalidate]; } - (void)dismissError { [SVProgressHUD showErrorWithStatus:@"Failed with Error"]; [timer invalidate]; }