added iOS source code
[wl-app.git] / iOS / Pods / FolioReaderKit / Source / EPUBCore / FRSpine.swift
1 //
2 //  FRSpine.swift
3 //  FolioReaderKit
4 //
5 //  Created by Heberti Almeida on 06/05/15.
6 //  Copyright (c) 2015 Folio Reader. All rights reserved.
7 //
8
9 import UIKit
10
11 struct Spine {
12     var linear: Bool
13     var resource: FRResource
14
15     init(resource: FRResource, linear: Bool = true) {
16         self.resource = resource
17         self.linear = linear
18     }
19 }
20
21 class FRSpine: NSObject {
22     var pageProgressionDirection: String?
23     var spineReferences = [Spine]()
24
25     var isRtl: Bool {
26         if let pageProgressionDirection = pageProgressionDirection , pageProgressionDirection == "rtl" {
27             return true
28         }
29         return false
30     }
31
32     func nextChapter(_ href: String) -> FRResource? {
33         var found = false;
34
35         for item in spineReferences {
36             if(found){
37                 return item.resource
38             }
39
40             if(item.resource.href == href) {
41                 found = true
42             }
43         }
44         return nil
45     }
46 }