linkedin/Selene
حول
مكتبة iOS لجدولة تنفيذ المهام عبر جلب البيانات في الخلفية.
تطوير الويب والتطبيقاتالنمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- ٠
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصل
Selene is an iOS library which schedules the execution of tasks on a background fetch.
Installation
Swift Package Manager
In Xcode, choose File > Add Package Dependencies, enter
https://github.com/linkedin/Selene.git, and add the Selene library product.
Use the master branch until a release containing Package.swift is available.
Swift Package Manager integration requires iOS 8.0 or later.
CocoaPods
Add to your Podfile:
pod Selene
Submodule
You can also add this repo as a submodule and copy everything in the Selene folder into your project.
Use
1) Add the fetch background mode in your app’s Info.plist file.
2) Create a task
A task must conform to SLNTaskProtocol. For example:
@interface SampleTask: NSObject<SLNTaskProtocol>
@end
@implementation SampleTask
+ (NSString *)identifier {
return NSStringFromClass(self);
}
+ (NSOperation *)operationWithCompletion:(SLNTaskCompletion_t)completion {
NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
// Do some work ....
completion(UIBackgroundFetchResultNoData);
}];
return operation;
}
+ (CGFloat)averageResponseTime {
return 5.0;
}
+ (SLNTaskPriority)priority {
return SLNTaskPriorityLow;
}
@end
3) Add the task class to the scheduler
NSArray *tasks = @[[SomeTask class]];
// Run the scheduler every 5 minutes
[SLNScheduler setMinimumBackgroundFetchInterval:60 * 5];
// Add the tasks
[SLNScheduler scheduleTasks:tasks];
In the application delegate:
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
[SLNScheduler startWithCompletion:completionHandler];
}
Interested? Here's the blog post
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…