added iOS source code
[wl-app.git] / iOS / Pods / FolioReaderKit / Source / EPUBCore / FRSpine.swift
diff --git a/iOS/Pods/FolioReaderKit/Source/EPUBCore/FRSpine.swift b/iOS/Pods/FolioReaderKit/Source/EPUBCore/FRSpine.swift
new file mode 100755 (executable)
index 0000000..958774b
--- /dev/null
@@ -0,0 +1,46 @@
+//
+//  FRSpine.swift
+//  FolioReaderKit
+//
+//  Created by Heberti Almeida on 06/05/15.
+//  Copyright (c) 2015 Folio Reader. All rights reserved.
+//
+
+import UIKit
+
+struct Spine {
+    var linear: Bool
+    var resource: FRResource
+
+    init(resource: FRResource, linear: Bool = true) {
+        self.resource = resource
+        self.linear = linear
+    }
+}
+
+class FRSpine: NSObject {
+    var pageProgressionDirection: String?
+    var spineReferences = [Spine]()
+
+    var isRtl: Bool {
+        if let pageProgressionDirection = pageProgressionDirection , pageProgressionDirection == "rtl" {
+            return true
+        }
+        return false
+    }
+
+    func nextChapter(_ href: String) -> FRResource? {
+        var found = false;
+
+        for item in spineReferences {
+            if(found){
+                return item.resource
+            }
+
+            if(item.resource.href == href) {
+                found = true
+            }
+        }
+        return nil
+    }
+}