Giter Site home page Giter Site logo

ocprayertimes's Introduction

Objective-C Library for Muslim Prayer Times

Build Status

OCPrayerTimes is an Objective-C library for calculating Muslim Prayer Times. Modified version of the original source code written by Hamid Zarrabi-Zadeh and Hussain Ali from PrayTimes.org. The source code was modified by Sumardi Shukor for taking advantage of modern Objective-C language such as ARC, object literals, etc.

Requirements

OCPrayerTimes 0.1.0 and higher requires Xcode 5, targeting either iOS 6.0 and above, or Mac OS 10.8 Mountain Lion (64-bit with modern Cocoa runtime) and above.

The following Cocoa frameworks must be linked into the application target for proper compilation:

  • CoreLocation.framework

Installation

CocoaPods (Recommended)

CocoaPods is the recommended way to add OCPrayerTimes to your Xcode project.

Here's an example Podfile that installs OCPrayerTimes.

Podfile

platform :osx, '10.8'
pod 'OCPrayerTimes', '~> 0.1.0'

Then run pod install.

Manual

Just add PrayTime.h and PrayTime.m to your Xcode project.

Examples

Depending on how you configure your project you may need to #import either <OCPrayerTimes/PrayTime.h> or "PrayTime.h".

Getting prayer times for a given longitude and latitude

PrayTime *prayerTime = [[PrayTime alloc] initWithJuristic:JuristicMethodShafii
                                           andCalculation:CalculationMethodMWL];
NSMutableArray *prayerTimes = [prayerTime prayerTimesDate:[NSDate date]
                                                 latitude:3.1667
                                                longitude:101.7000
                                              andTimezone:[prayerTime getTimeZone]];
NSLog(@"%@", prayerTimes);

Getting prayer times from current user location

- (void)viewDidLoad
{
    [super viewDidLoad];
	
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.distanceFilter = kCLDistanceFilterNone;
    self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
    self.locationManager.delegate = self;
    
    [self.locationManager startUpdatingLocation];

    prayTime = [[PrayTime alloc] initWithJuristic:JuristicMethodShafii
                                   andCalculation:CalculationMethodMWL];
    [prayTime setTimeFormat:TimeFormat12Hour];
}

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    CLLocation *location = [locations lastObject];
    
    praytime = [prayTime prayerTimesFromLocation:location
                                         forDate:[NSDate date]];
}

Documentation

License

OCPrayerTimes is available under the MIT license (see LICENSE file).

PrayTimes is free software; it is released under a GNU LGPL v3.0 license that allows you to do as you wish with it as long as you don't attempt to claim it as your own work.

Reference

Support

Bugs and feature request are tracked on Github

Credit

The code on which this package is based, is principally developed and maintained by Sumardi Shukor.

ocprayertimes's People

Contributors

soule avatar sumardi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.