Latest 0.0.1
License MIT
Platforms ios 8.0, requires ARC

Detects user’s angle to Kaaba.


QiblaDirection can be added to your project using Cocoapods.

pod 'QiblaDirection'

or just add the QiblaDirection.swift file to your project


In your ViewController, add the following protocol: QiblaDirectionDelegate

Define QiblaDirection as an instance variable.

You can handle Location Authorization yourself or also let the QiblaDirection handle itself by sending true to the askForAuthorizationIfNeeded parameter in the constructor method.

var qibla: QiblaDirection?

override func viewDidLoad() {

        self.qibla = QiblaDirection(delegate: self, askForAuthorizationIfNeeded: true)

Note: In your Info.plist file, be sure the following key exists with a brief description to ensure location services is enabled for your app: NSLocationWhenInUseUsageDescription

Handling Delegate Methods

    func qiblaDirectionNeedsAuthorization() {
        // Authorisation can be handled here.

    func qiblaHeadingDidChange(inPoint: Bool, headingAngle: Double) {
        let text = inPoint ? "YES" : "NO"
        println("Qibla in point: (text) nHeading angle  (headingAngle) degree")

    func qiblaAngleDidChanged(angle: Double) {
        println("Qibla Angle: (angle) degree")

Latest podspec

    "name": "QiblaDirection",
    "version": "0.0.1",
    "license": "MIT",
    "summary": "Detects users angle to Kaaba in Swift",
    "homepage": "",
    "social_media_url": "",
    "authors": {
        "Ethem Ozcan": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.0.1"
    "platforms": {
        "ios": "8.0"
    "source_files": "QiblaDirection.swift",
    "requires_arc": true

Pin It on Pinterest

Share This