Skip to content

Commit 732c1a3

Browse files
Merge pull request #47 from readium/develop
1.0.5
2 parents 898adf7 + 69b6d5b commit 732c1a3

File tree

12 files changed

+418
-406
lines changed

12 files changed

+418
-406
lines changed

opds/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: swift
2-
osx_image: xcode9.3
2+
osx_image: xcode10.1
33

44
branches:
55
only:

opds/Cartfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
github "Readium/r2-shared-swift" "master"
2-
github "mxcl/PromiseKit" == 4.5.2
3-
github "cezheng/Fuzi" == 2.0.2
1+
github "readium/r2-shared-swift" "develop"
2+
github "cezheng/Fuzi" == 2.2.1

opds/Cartfile.resolved

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
github "Hearst-DD/ObjectMapper" "2.2.0"
2-
github "Readium/r2-shared-swift" "07f5fe26381e0980925f7a16e8c05a1c7455ea45"
3-
github "cezheng/Fuzi" "2.0.2"
4-
github "mxcl/PromiseKit" "4.5.2"
1+
github "cezheng/Fuzi" "2.2.1"
2+
github "readium/r2-shared-swift" "c01177ff01bf52b6722b2842a53485b4a9781790"

opds/README.md

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,61 @@ and [Readium Web Publication Manifest](https://github.com/readium/webpub-manifes
1818

1919
## Getting started
2020

21-
### Adding the library to your iOS project
21+
## Adding the library to your iOS project
2222

23-
#### Carthage
23+
> _Note:_ requires Swift 4.2 (and Xcode 10.1).
2424
25-
Add the following line to your Cartfile
25+
### Carthage
2626

27-
`github "readium/readium-opds-swift"`
27+
[Carthage][] is a simple, decentralized dependency manager for Cocoa. To
28+
install ReadiumOPDS with Carthage:
29+
30+
1. Make sure Carthage is [installed][Carthage Installation].
31+
32+
2. Update your Cartfile to include the following:
33+
34+
```ruby
35+
github "readium/r2-opds-swift" ~> 1.0.4
36+
```
37+
38+
3. Run `carthage update` and
39+
[add the appropriate framework][Carthage Usage].
40+
41+
42+
[Carthage]: https://github.com/Carthage/Carthage
43+
[Carthage Installation]: https://github.com/Carthage/Carthage#installing-carthage
44+
[Carthage Usage]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
45+
46+
47+
### CocoaPods
48+
49+
[CocoaPods][] is a dependency manager for Cocoa projects. To install
50+
ReadiumOPDS with CocoaPods:
51+
52+
1. Make sure CocoaPods is [installed][CocoaPods Installation]. (ReadiumOPDS
53+
requires version 1.0.0 or greater.)
54+
55+
```sh
56+
# Using the default Ruby install will require you to use sudo when
57+
# installing and updating gems.
58+
[sudo] gem install cocoapods
59+
```
60+
61+
2. Update your Podfile to include the following:
62+
63+
```ruby
64+
use_frameworks!
65+
66+
target 'YourAppTargetName' do
67+
pod 'ReadiumOPDS', :git => 'https://github.com/readium/r2-opds-swift.git', '~> 1.0.4'
68+
end
69+
```
70+
71+
3. Run `pod install --repo-update`.
72+
73+
[CocoaPods]: https://cocoapods.org
74+
[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started
2875

29-
Then run `carthage update --platform ios` to fetch and build the dependencies.
3076

3177
#### Import
3278

@@ -38,17 +84,12 @@ In your Swift files:
3884
import ReadiumOPDS
3985
```
4086

41-
#### Installing dependencies (for developers)
42-
43-
The project dependencies are managed with [Carthage](https://github.com/Carthage/Carthage).
87+
#### Dependencies in this module
4488

45-
Run `carthage update --platform ios` to fetch and build the dependencies:
46-
47-
- [r2-shared-swift](https://github.com/readium/r2-shared-swift) : Custom types shared by several readium-2 Swift modules.
48-
- [PromiseKit](https://github.com/mxcl/PromiseKit) : Promises for Swift & ObjC.
89+
- [R2Shared](https://github.com/readium/r2-shared-swift) : Custom types shared by several readium-2 Swift modules.
4990
- [Fuzi](https://github.com/cezheng/Fuzi) : A fast & lightweight XML & HTML parser in Swift with XPath & CSS support.
5091

51-
Then, in Xcode:
92+
Modifications needed in Xcode:
5293

5394
In `Build Settings`, find `Search Paths`, add `$(SDKROOT)/usr/include/libxml2` to `Header Search Paths`.
5495

@@ -58,23 +99,19 @@ Parsing an OPDS feed (v1.x or 2.x):
5899

59100
```Swift
60101
import ReadiumOPDS
61-
import PromiseKit
62102
63103
let myURL = URL(string: "https://your/custom/url")
64104
var parseData: ParseData?
65105
66106
override func viewDidLoad() {
67107
super.viewDidLoad()
68108
69-
firstly {
70-
// Fetch and parse data from the specified URL
71-
OPDSParser.parseURL(url: myURL)
72-
}.then { newParseData -> Void in
73-
// parseData property holds the OPDS related data
74-
self.parseData = newParseData
75-
}.always {
76-
// Here, you can perform some checks on your own and refresh your UI
77-
self.refreshUI()
109+
// Fetch and parse data from the specified URL
110+
OPDSParser.parseURL(url: myURL) { data, error in
111+
if let data = data {
112+
// parseData property holds the OPDS related data
113+
self.parseData = data
114+
}
78115
}
79116
}
80117
@@ -101,7 +138,7 @@ public enum Version {
101138

102139
```Swift
103140
/// An intermediate structure return when the generic helper method public static
104-
/// func parseURL(url: URL) -> Promise<ParseData> from OPDSParser class is called.
141+
/// func parseURL(url: URL, completion: (ParseData?, Error?) -> Void) from OPDSParser class is called.
105142
public struct ParseData {
106143
/// The ressource URL
107144
public var url: URL
@@ -126,6 +163,5 @@ public struct ParseData {
126163
/// Parse an OPDS feed or publication.
127164
/// Feed can be v1 (XML) or v2 (JSON).
128165
/// - parameter url: The feed URL
129-
/// - Returns: A promise with the intermediate structure of type ParseData
130-
public static func parseURL(url: URL) -> Promise<ParseData>
131-
```
166+
public static func parseURL(url: URL, completion: (ParseData?, Error?) -> Void)
167+
```

opds/ReadiumOPDS.podspec

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Pod::Spec.new do |s|
2+
3+
s.name = "ReadiumOPDS"
4+
s.version = "1.0.4"
5+
s.summary = "Readium OPDS"
6+
s.homepage = "http://readium.github.io"
7+
s.license = "BSD 3-Clause License"
8+
s.author = { "Aferdita Muriqi" => "aferdita.muriqi@gmail.com" }
9+
s.platform = :ios
10+
s.ios.deployment_target = "9.0"
11+
s.source = { :git => "https://github.com/readium/r2-opds-swift.git", :branch => "develop" }
12+
s.source_files = "readium-opds/**/*.{m,h,swift}"
13+
s.exclude_files = ["**/Info*.plist","**/Carthage/*"]
14+
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/ReadiumOPDS/**"' ,
15+
'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2'}
16+
s.swift_version = "4.2"
17+
18+
s.dependency 'R2Shared'
19+
s.dependency 'Fuzi'
20+
21+
end

opds/readium-opds.xcodeproj/project.pbxproj

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,41 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
03B873F120F660D300D96791 /* Fuzi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE0AC4A520AB1F8B00B2FC36 /* Fuzi.framework */; };
11-
111E54D5201FB0AD00A7FE9A /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 111E54D4201FB0AC00A7FE9A /* PromiseKit.framework */; };
10+
03C3CC64222DBD2F00A01731 /* R2Shared.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03C3CC63222DBD2F00A01731 /* R2Shared.framework */; };
1211
111E54DC2021022700A7FE9A /* OPDS2Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 111E54DB2021022700A7FE9A /* OPDS2Parser.swift */; };
1312
AE49834720D902710013B912 /* ParseData.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE49834620D902710013B912 /* ParseData.swift */; };
1413
AE6B98E020CAB93200117197 /* OPDSParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6B98DF20CAB93200117197 /* OPDSParser.swift */; };
1514
AED681F020A316160090DBCD /* URLHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AED681EF20A316160090DBCD /* URLHelper.swift */; };
15+
CA415ECB221D5307003A0F7F /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA415EC9221D5182003A0F7F /* Deprecated.swift */; };
1616
F34B7E5E1FA35B7900534FD3 /* readium_opds.h in Headers */ = {isa = PBXBuildFile; fileRef = F34B7E501FA35B7900534FD3 /* readium_opds.h */; settings = {ATTRIBUTES = (Public, ); }; };
1717
F34B7E691FA35BB100534FD3 /* OPDS1Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34B7E681FA35BB100534FD3 /* OPDS1Parser.swift */; };
18-
F34B7E701FA3771E00534FD3 /* R2Shared.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F34B7E6B1FA35CEA00534FD3 /* R2Shared.framework */; };
1918
/* End PBXBuildFile section */
2019

2120
/* Begin PBXFileReference section */
21+
03C3CC63222DBD2F00A01731 /* R2Shared.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = R2Shared.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2222
111E54CC201BBD9700A7FE9A /* wiki_1_1.opds */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = wiki_1_1.opds; path = "readium-opdsTests/Samples/wiki_1_1.opds"; sourceTree = SOURCE_ROOT; };
23-
111E54D4201FB0AC00A7FE9A /* PromiseKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PromiseKit.framework; path = Carthage/Build/iOS/PromiseKit.framework; sourceTree = "<group>"; };
2423
111E54D9201FC91600A7FE9A /* feedbooks_catalog.atom */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = feedbooks_catalog.atom; path = "readium-opdsTests/Samples/feedbooks_catalog.atom"; sourceTree = SOURCE_ROOT; };
2524
111E54DB2021022700A7FE9A /* OPDS2Parser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OPDS2Parser.swift; sourceTree = "<group>"; };
2625
111E54DE2022812B00A7FE9A /* opds_2_0.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = opds_2_0.json; path = "readium-opdsTests/Samples/opds_2_0.json"; sourceTree = SOURCE_ROOT; };
2726
111E54E02022816000A7FE9A /* readium_opds2_0_test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = readium_opds2_0_test.swift; sourceTree = "<group>"; };
28-
AE0AC4A520AB1F8B00B2FC36 /* Fuzi.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Fuzi.framework; path = Carthage/Build/iOS/Fuzi.framework; sourceTree = "<group>"; };
2927
AE49834620D902710013B912 /* ParseData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParseData.swift; sourceTree = "<group>"; };
3028
AE6B98DF20CAB93200117197 /* OPDSParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OPDSParser.swift; sourceTree = "<group>"; };
3129
AED681EF20A316160090DBCD /* URLHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URLHelper.swift; sourceTree = "<group>"; };
30+
CA415EC9221D5182003A0F7F /* Deprecated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deprecated.swift; sourceTree = "<group>"; };
3231
F34B7E4D1FA35B7900534FD3 /* ReadiumOPDS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReadiumOPDS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3332
F34B7E501FA35B7900534FD3 /* readium_opds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = readium_opds.h; sourceTree = "<group>"; };
3433
F34B7E511FA35B7900534FD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3534
F34B7E5B1FA35B7900534FD3 /* readium_opds1_1_test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = readium_opds1_1_test.swift; sourceTree = "<group>"; };
3635
F34B7E5D1FA35B7900534FD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3736
F34B7E681FA35BB100534FD3 /* OPDS1Parser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OPDS1Parser.swift; sourceTree = "<group>"; };
38-
F34B7E6B1FA35CEA00534FD3 /* R2Shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = R2Shared.framework; path = Carthage/Build/iOS/R2Shared.framework; sourceTree = "<group>"; };
3937
/* End PBXFileReference section */
4038

4139
/* Begin PBXFrameworksBuildPhase section */
4240
F34B7E491FA35B7900534FD3 /* Frameworks */ = {
4341
isa = PBXFrameworksBuildPhase;
4442
buildActionMask = 2147483647;
4543
files = (
46-
03B873F120F660D300D96791 /* Fuzi.framework in Frameworks */,
47-
111E54D5201FB0AD00A7FE9A /* PromiseKit.framework in Frameworks */,
48-
F34B7E701FA3771E00534FD3 /* R2Shared.framework in Frameworks */,
44+
03C3CC64222DBD2F00A01731 /* R2Shared.framework in Frameworks */,
4945
);
5046
runOnlyForDeploymentPostprocessing = 0;
5147
};
@@ -85,6 +81,7 @@
8581
children = (
8682
F34B7E501FA35B7900534FD3 /* readium_opds.h */,
8783
F34B7E511FA35B7900534FD3 /* Info.plist */,
84+
CA415EC9221D5182003A0F7F /* Deprecated.swift */,
8885
AE6B98DF20CAB93200117197 /* OPDSParser.swift */,
8986
F34B7E681FA35BB100534FD3 /* OPDS1Parser.swift */,
9087
111E54DB2021022700A7FE9A /* OPDS2Parser.swift */,
@@ -108,9 +105,7 @@
108105
F34B7E6A1FA35CEA00534FD3 /* Frameworks */ = {
109106
isa = PBXGroup;
110107
children = (
111-
AE0AC4A520AB1F8B00B2FC36 /* Fuzi.framework */,
112-
111E54D4201FB0AC00A7FE9A /* PromiseKit.framework */,
113-
F34B7E6B1FA35CEA00534FD3 /* R2Shared.framework */,
108+
03C3CC63222DBD2F00A01731 /* R2Shared.framework */,
114109
);
115110
name = Frameworks;
116111
sourceTree = "<group>";
@@ -159,7 +154,7 @@
159154
TargetAttributes = {
160155
F34B7E4C1FA35B7900534FD3 = {
161156
CreatedOnToolsVersion = 9.0.1;
162-
LastSwiftMigration = 0900;
157+
LastSwiftMigration = 1010;
163158
ProvisioningStyle = Manual;
164159
};
165160
};
@@ -196,6 +191,7 @@
196191
isa = PBXSourcesBuildPhase;
197192
buildActionMask = 2147483647;
198193
files = (
194+
CA415ECB221D5307003A0F7F /* Deprecated.swift in Sources */,
199195
AED681F020A316160090DBCD /* URLHelper.swift in Sources */,
200196
F34B7E691FA35BB100534FD3 /* OPDS1Parser.swift in Sources */,
201197
AE6B98E020CAB93200117197 /* OPDSParser.swift in Sources */,
@@ -343,13 +339,13 @@
343339
INFOPLIST_FILE = "readium-opds/Info.plist";
344340
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
345341
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
346-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
342+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
347343
PRODUCT_BUNDLE_IDENTIFIER = "com.readium.readium-opds";
348344
PRODUCT_NAME = ReadiumOPDS;
349345
PROVISIONING_PROFILE_SPECIFIER = "";
350346
SKIP_INSTALL = YES;
351347
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
352-
SWIFT_VERSION = 4.0;
348+
SWIFT_VERSION = 4.2;
353349
TARGETED_DEVICE_FAMILY = "1,2";
354350
};
355351
name = Debug;
@@ -373,12 +369,12 @@
373369
INFOPLIST_FILE = "readium-opds/Info.plist";
374370
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
375371
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
376-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
372+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
377373
PRODUCT_BUNDLE_IDENTIFIER = "com.readium.readium-opds";
378374
PRODUCT_NAME = ReadiumOPDS;
379375
PROVISIONING_PROFILE_SPECIFIER = "";
380376
SKIP_INSTALL = YES;
381-
SWIFT_VERSION = 4.0;
377+
SWIFT_VERSION = 4.2;
382378
TARGETED_DEVICE_FAMILY = "1,2";
383379
};
384380
name = Release;

opds/readium-opds.xcodeproj/xcshareddata/xcschemes/readium-opds.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0940"
3+
LastUpgradeVersion = "1010"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

opds/readium-opds/Deprecated.swift

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// Deprecated.swift
3+
// readium-opds
4+
//
5+
// Created by Mickaël Menu on 20.02.19.
6+
//
7+
// Copyright 2018 Readium Foundation. All rights reserved.
8+
// Use of this source code is governed by a BSD-style license which is detailed
9+
// in the LICENSE file present in the project repository where this source code is maintained.
10+
//
11+
12+
import Foundation
13+
import R2Shared
14+
15+
public typealias Promise<T> = Void
16+
17+
extension OPDSParser {
18+
19+
@available(*, unavailable, message: "Use `parseURL(url:completion:)` instead")
20+
public static func parseURL(url: URL) -> Promise<ParseData> {}
21+
22+
}
23+
24+
extension OPDS1Parser {
25+
26+
@available(*, unavailable, message: "Use `parseURL(url:completion:)` instead")
27+
public static func parseURL(url: URL) -> Promise<ParseData> {}
28+
29+
@available(*, unavailable, message: "Use `fetchOpenSearchTemplate(feed:completion:)` instead")
30+
public static func fetchOpenSearchTemplate(feed: Feed) -> Promise<String> {}
31+
32+
}
33+
34+
extension OPDS2Parser {
35+
36+
@available(*, unavailable, message: "Use `parseURL(url:completion:)` instead")
37+
public static func parseURL(url: URL) -> Promise<ParseData> {}
38+
39+
}

0 commit comments

Comments
 (0)