This is a scaffold library and the aid of the project is providing all foundation functions for IOS
developer to build app easier.
The aim of the project provides base foundation functions for IOS developer to make developer build iOS app easier. I am trying hard to make it can be used for Objective-C and Swift projects.
In A-IOSHelper, all functions are having the A_
prefix, so we can get advantage from IDE's hint.
For using this framework, you can compile it and add the compiled file, A_IOSHelper.framework, into your project at Project page -> General -> Target -> Embedded Binaries section. If your project is older then iOS 8.0, I recommend that copying whole source code to your project.
Please use build.sh
file to build this project.
sh ./build.sh
OR
sudo sh ./build.sh
You might want to check the compiled file by
cd Product/A_IOSHelper.framework
lipo -info A_IOSHelper
It should show Architectures in the fat file: A_IOSHelper are: i386 x86_64 armv7 arm64
which means compiled success.
The Obecrive-C example:
#import <A_IOSHelper/A_IOSHelper.h>
Get data from 2 web services concurrently, and when all of them completed, pop-up an alert view in main thread.
[[[[A_TaskHelper A_Init:A_Task_RunInBackgroupCompleteInMain
Sequential:NO] A_AddTask:^(A_TaskHelper *task) {
// Visit first service and store the result with the name "task1"
[task A_Set:@"task1" Value:[A_RESTRequest A_GetArray:@"http://webservice_1"]];
}] A_AddTask:^(A_TaskHelper *task) {
// Visit second service and store the result with the name "task2"
[task A_Set:@"task2" Value:[A_RESTRequest A_GetDictionary:@"http://webservice_2"]];
}] A_ExecuteWithCompletion:^(A_TaskHelper *task) {
// Merge two
[UIAlertView A_DisplyAlert:[NSString stringWithFormat:@"%@ %@",
[task A_Get:@"task1"],
[task A_Get:@"task2"]]
AndTitle:@"Result"
CancelButton:@"Okay"];
}];
The Swfit example:
import A_IOSHelper
Download image and cache it, and it can get same image next time from cache instead of download again.
A_ImageHelper.A_DownloadImageAndCache("http://yourwebservice/image.jpg")
More example please check on the detail pages.