SUAISchedule 0.1.5

SUAISchedule 0.1.5

Maintained by Victor Volkov.



 
Depends on:
AFNetworking>= 0
HTMLKit>= 0
 

  • By
  • Victor Volkov

SUAISchedule

CI Status Version License Platform

SUAISchedule is a lightweight and very simple library for load schedule of groups or teachers studying in Saint Petersburg State University of Aerospace Instrumentation. Current version is beta, it doesn't obtain status of internet connection and not return adequate error codes.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

SUAISchedule is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SUAISchedule'

Usage

Library contains SUAIManager class, which is a singleton, it means that during all program execution you will have only one instance of this class (it's necessary to load entity codes once and store it in instance).

SUAIManager have one delegate method:

- (void)didChangeStatus:(Status)status;

Where Status is a structure which means current status of SUAIManager:

  1. Ok (i.e all codes is loaded and SUAIManager can load any schedule you need);
  2. Error (i.e. SUAIManager doesn't contain codes or it have problems with internet connection).

Full description of Status below:

typedef enum Status {
    Ok,
    Error
}Status;

Step by step

  1. Import SUAIManager.h to your class:
#import "SUAIManager.h"
  1. Set delegate if you want to obtain status of SUAIManager and of course implement method in class:
[SUAIManager instance].delegate = self;
  1. Use method:
- (void)loadScheduleFor:(NSString *)identificator
           ofEntityType:(Entity)entity
                success:(void (^) (SUAISchedule *schedule))schedule
                   fail:(void (^) (NSString *fail))fail;

For getting schedule for teacher or group passed in first argument (for example, 1740M). Also you need to pass entity. In next releases may be entity will be deprecated.

Important

Don't forget to allow arbitrary loads! It's pretty easy:

  1. Go to plist file;
  2. In information property list add new key "App Transport Security Settings";
  3. In added dictionary add key "Allow Arbitrary Loads" and set value to YES.

Requirements

  • Xcode
  • Objective-C
  • iOS 9.0 or higher

Author

Victor Volkov, [email protected]

License

SUAISchedule is available under the MIT license. See the LICENSE file for more info.