Create Universal Static Libraries
Step1:
FILE\NEW Project\Framework & Library\cocoa touch static library
Step 2: Code your static library
#import <Foundation/Foundation.h> @interface Tutorial_Lib_staticLib : NSObject{ } - (NSArray *) fibonacci:(NSInteger) n; - (NSInteger) factorial:(NSInteger) n; @end
#import "Tutorial_Lib_staticLib.h" @implementation Tutorial_Lib_staticLib - (id)init { self = [super init]; if (self) { // Initialization code here. } return self; } - (NSArray *) fibonacci:(NSInteger) n { NSMutableArray *fib = [NSMutableArray array]; int a = 0; int b = 1; int sum; int i; for (i=0;i < n;i++) { [fib addObject:[NSNumber numberWithInt:a]]; sum = a + b; a = b; b = sum; } return (NSArray *) fib; } - (NSInteger) factorial:(NSInteger) n { if ( n <= 1 ) return 1; else return n * [self factorial:( n-1 )]; } @end
build
copy the your
xxx.a
xxx.h
to share your friends and coworkers.
sample code:
Tutorial_Lib_staticLib