# 私有庫使用方式 > [time=Tue, Dec 24, 2019 2:31 PM] ###### tags: `CocoaPods` ##### 此文案已有段時間未更新,使用上需稍微對照。 ## Requirements * iOS 9+ * Xcode 8+ ## Installation CocoaPods ``` pod 'HsConnection' ``` Then, run the following command: ``` $ pod install ``` ## Usage ``` #import <HsConnection/HsHeader.h> ``` Very simple code: ``` HsConnection *connection = [[HsConnection alloc] init]; [connection setDelegate = self]; [connection method:GET uri:@"https://www.google.com"]; [connection go]; ``` Set `header` ``` [connection headerArray:@[ @[@"Accept", @"application/json"], .. ]]; ``` Set `body` ``` [connection bodyArray:@[ @[@"body", @"1234567890"], .. ]]; ``` or ``` [connection bodyString:@"body=1234567890"]; ``` HsConnectionDelegate ``` @interface ViewController () <HsConnectionDelegate> ``` ``` - (void)hsConnectionAnimateBegin { NSLog(@"animateBegin"); } - (void)hsConnectionAnimateEnd { NSLog(@"animateEnd"); } - (void)hsConnectionSuccess:(NSDictionary *)dictionary { NSLog(@"success, %@", dictionary); } - (void)hsConnectionFailure:(NSException *)exception { NSLog(@"failure, %@", exception); } ``` ## Quick get value from path ``` info = { date = "2018-03-19 08:24:30.000000"; timezone = UTC; "timezone_type" = 3; }; ``` If you want to get `date`, you can do this: ``` NSDictionary *dictionary = ... [dictionary valueForPath:@"info->date"]; ``` If `date` in array of index is 2, you also can do this: ``` NSDictionary *dictionary = ... [dictionary valueForPath:@"info->array[2]->date"]; ``` ## Quick print NSLog and pause code You know that, if you used `laravel`: ``` dd(); ```