From 394e6fd3f479e10483dfcedddf869db727ee8c22 Mon Sep 17 00:00:00 2001 From: fantim Date: Fri, 4 Jan 2019 07:40:26 +0800 Subject: [PATCH 01/14] Changed dependencies to work with iOS 12.1 and xCode 10.1 --- FolioReaderKit.podspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 FolioReaderKit.podspec diff --git a/FolioReaderKit.podspec b/FolioReaderKit.podspec old mode 100644 new mode 100755 index 4a0388c10..a249fcee0 --- a/FolioReaderKit.podspec +++ b/FolioReaderKit.podspec @@ -31,11 +31,11 @@ Pod::Spec.new do |s| s.libraries = "z" s.dependency 'SSZipArchive', '2.1.1' - s.dependency 'MenuItemKit', '3.0.0' + s.dependency 'MenuItemKit', '3.1.3' s.dependency 'ZFDragableModalTransition', '0.6' - s.dependency 'AEXML', '4.2.2' - s.dependency 'FontBlaster', '4.0.1' + s.dependency 'AEXML', '4.3.3' + s.dependency 'FontBlaster', '4.1.0' s.dependency 'JSQWebViewController', '6.0.0' - s.dependency 'RealmSwift', '3.1.1' + s.dependency 'RealmSwift', '3.13.0' end From eb8f303cabdee28bb8df18983a1a5221d239a45e Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 5 Jan 2019 09:30:14 +0800 Subject: [PATCH 02/14] updated dependencies to work with latest Xcode (10.1) and iOS (12.1) --- Cartfile | 8 ++--- Cartfile.resolved | 8 ++--- Example/Example.xcodeproj/project.pbxproj | 16 ---------- Example/Podfile.lock | 38 +++++++++++------------ 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/Cartfile b/Cartfile index 62b60a747..d03518979 100644 --- a/Cartfile +++ b/Cartfile @@ -1,7 +1,7 @@ github "ZipArchive/ZipArchive" == 2.1.1 -github "cxa/MenuItemKit" == 3.0.0 +github "cxa/MenuItemKit" == 3.1.3 github "alexpopov/ZFDragableModalTransition" "merge-carthage-into-zoonooz" -github "tadija/AEXML" == 4.2.2 -github "ArtSabintsev/FontBlaster" == 4.0.1 +github "tadija/AEXML" == 4.3.3 +github "ArtSabintsev/FontBlaster" == 4.1.0 github "jessesquires/JSQWebViewController" == 6.0.0 -github "realm/realm-cocoa" == 3.1.1 +github "realm/realm-cocoa" == 3.13.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 883b6f499..43f7c7ec7 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,7 @@ -github "ArtSabintsev/FontBlaster" "4.0.1" +github "ArtSabintsev/FontBlaster" "4.1.0" github "ZipArchive/ZipArchive" "v2.1.1" github "alexpopov/ZFDragableModalTransition" "8da951efb4202385630d1cf7104b60d1208f807e" -github "cxa/MenuItemKit" "3.0.0" +github "cxa/MenuItemKit" "3.1.3" github "jessesquires/JSQWebViewController" "6.0.0" -github "realm/realm-cocoa" "v3.1.1" -github "tadija/AEXML" "4.2.2" +github "realm/realm-cocoa" "v3.13.0" +github "tadija/AEXML" "4.3.3" diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 076595264..46b881672 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -333,7 +333,6 @@ CA10C12F1C572A4B0049165D /* Resources */, C1392FF51E4FD15EBB5AA8DD /* [CP] Embed Pods Frameworks */, E82F486563C1547E0775A59F /* 📦 Embed Pods Frameworks */, - 064D38CE83FACC358B7C0EC8 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -489,21 +488,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 064D38CE83FACC358B7C0EC8 /* 📦 Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FolioReaderTests/Pods-FolioReaderTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 1D8126CC73301F2413345444 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 33f298757..7d169b59a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,23 +1,23 @@ PODS: - - AEXML (4.2.2) + - AEXML (4.3.3) - FolioReaderKit (1.3.0): - - AEXML (= 4.2.2) - - FontBlaster (= 4.0.1) + - AEXML (= 4.3.3) + - FontBlaster (= 4.1.0) - JSQWebViewController (= 6.0.0) - - MenuItemKit (= 3.0.0) - - RealmSwift (= 3.1.1) + - MenuItemKit (= 3.1.3) + - RealmSwift (= 3.13.0) - SSZipArchive (= 2.1.1) - ZFDragableModalTransition (= 0.6) - - FontBlaster (4.0.1) + - FontBlaster (4.1.0) - JSQWebViewController (6.0.0) - - MenuItemKit (3.0.0) + - MenuItemKit (3.1.3) - Nimble (7.0.2) - Quick (1.2.0) - - Realm (3.1.1): - - Realm/Headers (= 3.1.1) - - Realm/Headers (3.1.1) - - RealmSwift (3.1.1): - - Realm (= 3.1.1) + - Realm (3.13.0): + - Realm/Headers (= 3.13.0) + - Realm/Headers (3.13.0) + - RealmSwift (3.13.0): + - Realm (= 3.13.0) - SSZipArchive (2.1.1) - ZFDragableModalTransition (0.6) @@ -44,18 +44,18 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - AEXML: 5ebafc1b75e0bcf0f1b09b8ca8fed2d5a199479b - FolioReaderKit: 47af4947287e66a902d5d8af9577e10b8ad230f4 - FontBlaster: 84229df8e3a7a6dacb190565bc543747a0c323f9 + AEXML: 601f41fcaa7bda7605cad153b0f43db9ec006c0f + FolioReaderKit: 7a39d9d1f422b2ea0fa1ab36ca1c817e30821df8 + FontBlaster: 127aa66419478d1c62926c7fdb39841633344a45 JSQWebViewController: 51041569b75d19dbb6b7fe0b7ae053c32409a9be - MenuItemKit: d9b539b28fdbbd7980d6f3668b9cd6daefeabd9b + MenuItemKit: 0f850e630b0a3d2bd80fec54db87ce0d2077ada2 Nimble: bfe1f814edabba69ff145cb1283e04ed636a67f2 Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 - Realm: 42d1c38a5b1bbcc828b48a7ce702cb86fc68adf4 - RealmSwift: d31937ca6a6ee54acde64ec839523c0a3c04924b + Realm: 5edd2ee65406aef591a4f9895de5a3440e51b3d8 + RealmSwift: be5ebc7930e37cd3376b41cec7f21984528aaa16 SSZipArchive: 14401ade5f8e82aba1ff03e9f88e9de60937ae60 ZFDragableModalTransition: 0d294eaaba6edfcb9839595de765f9ca06a4b524 PODFILE CHECKSUM: d5e64429a71bc13b6eceb790b04656d8082e4d66 -COCOAPODS: 1.5.2 +COCOAPODS: 1.5.3 From f9a5347bbaf9aea5e13693d4034144430326b8b0 Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 12 Jan 2019 12:49:24 +0800 Subject: [PATCH 03/14] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 673eb12c2..86e7b5652 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -osx_image: xcode9.2 +osx_image: xcode10.1 language: objective-c cache: cocoapods podfile: Example/Podfile From 83b0e6639cff57c459639dbcaeebf88eea948ca6 Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 12 Jan 2019 12:57:49 +0800 Subject: [PATCH 04/14] updated tests to latest iOS --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86e7b5652..437b80ac7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ before_install: - pod install --project-directory=Example script: -- set -o pipefail && xcodebuild test -workspace Example/Example.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.2' | xcpretty +- set -o pipefail && xcodebuild test -workspace Example/Example.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1' | xcpretty # - pod lib lint --allow-warnings From 0aee84b769f24bd675409cba0df0ba123a8e87f2 Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 12 Jan 2019 13:16:21 +0800 Subject: [PATCH 05/14] Updated tests (Nimble and Quick) to latest versions --- .travis.yml | 2 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Example/Podfile | 4 ++-- Example/Podfile.lock | 14 +++++++------- 4 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.travis.yml b/.travis.yml index 437b80ac7..cff79e70a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ before_install: - pod install --project-directory=Example script: -- set -o pipefail && xcodebuild test -workspace Example/Example.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1' | xcpretty +- set -o pipefail && xcodebuild test -workspace Example/Example.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1.3' | xcpretty # - pod lib lint --allow-warnings diff --git a/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Podfile b/Example/Podfile index b16485040..f238478fa 100755 --- a/Example/Podfile +++ b/Example/Podfile @@ -8,8 +8,8 @@ def shared_pods end def testing_pods - pod 'Quick', '1.2.0' - pod 'Nimble', '7.0.2' + pod 'Quick', '1.3.2' + pod 'Nimble', '7.3.1' end target 'Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 7d169b59a..4e6e58e52 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -11,8 +11,8 @@ PODS: - FontBlaster (4.1.0) - JSQWebViewController (6.0.0) - MenuItemKit (3.1.3) - - Nimble (7.0.2) - - Quick (1.2.0) + - Nimble (7.3.1) + - Quick (1.3.2) - Realm (3.13.0): - Realm/Headers (= 3.13.0) - Realm/Headers (3.13.0) @@ -23,8 +23,8 @@ PODS: DEPENDENCIES: - FolioReaderKit (from `../`) - - Nimble (= 7.0.2) - - Quick (= 1.2.0) + - Nimble (= 7.3.1) + - Quick (= 1.3.2) SPEC REPOS: https://github.com/cocoapods/specs.git: @@ -49,13 +49,13 @@ SPEC CHECKSUMS: FontBlaster: 127aa66419478d1c62926c7fdb39841633344a45 JSQWebViewController: 51041569b75d19dbb6b7fe0b7ae053c32409a9be MenuItemKit: 0f850e630b0a3d2bd80fec54db87ce0d2077ada2 - Nimble: bfe1f814edabba69ff145cb1283e04ed636a67f2 - Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 + Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae + Quick: 2623cb30d7a7f41ca62f684f679586558f483d46 Realm: 5edd2ee65406aef591a4f9895de5a3440e51b3d8 RealmSwift: be5ebc7930e37cd3376b41cec7f21984528aaa16 SSZipArchive: 14401ade5f8e82aba1ff03e9f88e9de60937ae60 ZFDragableModalTransition: 0d294eaaba6edfcb9839595de765f9ca06a4b524 -PODFILE CHECKSUM: d5e64429a71bc13b6eceb790b04656d8082e4d66 +PODFILE CHECKSUM: 17e357644d3dbd614167f19e9702e48140887ab9 COCOAPODS: 1.5.3 From 1de40f344e1c9bd2f678ede346f30e110ac3bc4c Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 12 Jan 2019 13:24:53 +0800 Subject: [PATCH 06/14] Updated .travis.yml to latest test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cff79e70a..437b80ac7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ before_install: - pod install --project-directory=Example script: -- set -o pipefail && xcodebuild test -workspace Example/Example.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1.3' | xcpretty +- set -o pipefail && xcodebuild test -workspace Example/Example.xcworkspace -scheme Example -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1' | xcpretty # - pod lib lint --allow-warnings From 92f95da0beeec9a4ad4d70b6535f21aecf2122ab Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 12 Jan 2019 16:49:44 +0800 Subject: [PATCH 07/14] Fixed a thread lock issue causing example to Example to crash --- Source/Extensions.swift | 199 +++++++++++++++++++--------------------- 1 file changed, 95 insertions(+), 104 deletions(-) diff --git a/Source/Extensions.swift b/Source/Extensions.swift index 99558088b..81f0bc69c 100644 --- a/Source/Extensions.swift +++ b/Source/Extensions.swift @@ -31,7 +31,7 @@ extension CGSize { func forDirection(withConfiguration readerConfig: FolioReaderConfig) -> CGFloat { return readerConfig.isDirection(height, width, height) } - + func forReverseDirection(withConfiguration readerConfig: FolioReaderConfig) -> CGFloat { return readerConfig.isDirection(width, height, width) } @@ -47,7 +47,7 @@ extension ScrollDirection { static func negative(withConfiguration readerConfig: FolioReaderConfig, scrollType: ScrollType = .page) -> ScrollDirection { return readerConfig.isDirection(.down, .right, .right) } - + static func positive(withConfiguration readerConfig: FolioReaderConfig, scrollType: ScrollType = .page) -> ScrollDirection { return readerConfig.isDirection(.up, .left, .left) } @@ -58,7 +58,7 @@ extension ScrollDirection { /** Delay function From: http://stackoverflow.com/a/24318861/517707 - + - parameter delay: Delay in seconds - parameter closure: Closure */ @@ -81,7 +81,7 @@ internal extension UIColor { var green: CGFloat = 0.0 var blue: CGFloat = 0.0 var alpha: CGFloat = 1.0 - + if rgba.hasPrefix("#") { let index = rgba.index(rgba.startIndex, offsetBy: 1) let hex = String(rgba[index...]) @@ -123,7 +123,7 @@ internal extension UIColor { } self.init(red:red, green:green, blue:blue, alpha:alpha) } - + // /// Hex string of a UIColor instance. /// @@ -137,55 +137,55 @@ internal extension UIColor { var b: CGFloat = 0 var a: CGFloat = 0 self.getRed(&r, green: &g, blue: &b, alpha: &a) - + if (includeAlpha == true) { return String(format: "#%02X%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255), Int(a * 255)) } else { return String(format: "#%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255)) } } - + // MARK: - color shades // https://gist.github.com/mbigatti/c6be210a6bbc0ff25972 - + func highlightColor() -> UIColor { - + var hue : CGFloat = 0 var saturation : CGFloat = 0 var brightness : CGFloat = 0 var alpha : CGFloat = 0 - + if getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) { return UIColor(hue: hue, saturation: 0.30, brightness: 1, alpha: alpha) } else { return self; } - + } - + /** Returns a lighter color by the provided percentage - + :param: lighting percent percentage :returns: lighter UIColor */ func lighterColor(_ percent : Double) -> UIColor { return colorWithBrightnessFactor(CGFloat(1 + percent)); } - + /** Returns a darker color by the provided percentage - + :param: darking percent percentage :returns: darker UIColor */ func darkerColor(_ percent : Double) -> UIColor { return colorWithBrightnessFactor(CGFloat(1 - percent)); } - + /** Return a modified color using the brightness factor provided - + :param: factor brightness factor :returns: modified color */ @@ -194,7 +194,7 @@ internal extension UIColor { var saturation : CGFloat = 0 var brightness : CGFloat = 0 var alpha : CGFloat = 0 - + if getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) { return UIColor(hue: hue, saturation: saturation, brightness: brightness * factor, alpha: alpha) } else { @@ -214,32 +214,32 @@ internal extension String { return self } } - + func stripHtml() -> String { return self.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression) } - + func stripLineBreaks() -> String { return self.replacingOccurrences(of: "\n", with: "", options: .regularExpression) } - + /** Converts a clock time such as `0:05:01.2` to seconds (`Double`) - + Looks for media overlay clock formats as specified [here][1] - + - Note: this may not be the most efficient way of doing this. It can be improved later on. - + - Returns: seconds as `Double` - + [1]: http://www.idpf.org/epub/301/spec/epub-mediaoverlays.html#app-clock-examples */ func clockTimeToSeconds() -> Double { - + let val = self.trimmingCharacters(in: CharacterSet.whitespaces) - + if( val.isEmpty ){ return 0 } - + let formats = [ "HH:mm:ss.SSS" : "^\\d{1,2}:\\d{2}:\\d{2}\\.\\d{1,3}$", "HH:mm:ss" : "^\\d{1,2}:\\d{2}:\\d{2}$", @@ -247,98 +247,98 @@ internal extension String { "mm:ss" : "^\\d{1,2}:\\d{2}$", "ss.SSS" : "^\\d{1,2}\\.\\d{1,3}$", ] - + // search for normal duration formats such as `00:05:01.2` for (format, pattern) in formats { - + if val.range(of: pattern, options: .regularExpression) != nil { - + let formatter = DateFormatter() formatter.dateFormat = format let time = formatter.date(from: val) - + if( time == nil ){ return 0 } - + formatter.dateFormat = "ss.SSS" let seconds = (formatter.string(from: time!) as NSString).doubleValue - + formatter.dateFormat = "mm" let minutes = (formatter.string(from: time!) as NSString).doubleValue - + formatter.dateFormat = "HH" let hours = (formatter.string(from: time!) as NSString).doubleValue - + return seconds + (minutes*60) + (hours*60*60) } } - + // if none of the more common formats match, check for other possible formats - + // 2345ms if val.range(of: "^\\d+ms$", options: .regularExpression) != nil{ return (val as NSString).doubleValue / 1000.0 } - + // 7.25h if val.range(of: "^\\d+(\\.\\d+)?h$", options: .regularExpression) != nil { return (val as NSString).doubleValue * 60 * 60 } - + // 13min if val.range(of: "^\\d+(\\.\\d+)?min$", options: .regularExpression) != nil { return (val as NSString).doubleValue * 60 } - + return 0 } - + func clockTimeToMinutesString() -> String { - + let val = clockTimeToSeconds() - + let min = floor(val / 60) let sec = floor(val.truncatingRemainder(dividingBy: 60)) - + return String(format: "%02.f:%02.f", min, sec) } - + // MARK: - NSString helpers - + var lastPathComponent: String { return (self as NSString).lastPathComponent } - + var deletingLastPathComponent: String { return (self as NSString).deletingLastPathComponent } - + var deletingPathExtension: String { return (self as NSString).deletingPathExtension } - + var pathExtension: String { return (self as NSString).pathExtension } - + var abbreviatingWithTildeInPath: String { return (self as NSString).abbreviatingWithTildeInPath } - + func appendingPathComponent(_ str: String) -> String { return (self as NSString).appendingPathComponent(str) } - + func appendingPathExtension(_ str: String) -> String { return (self as NSString).appendingPathExtension(str) ?? self+"."+str } } internal extension UIImage { - + convenience init?(readerImageNamed: String) { self.init(named: readerImageNamed, in: Bundle.frameworkBundle(), compatibleWith: nil) } - + /// Forces the image to be colored with Reader Config tintColor /// /// - Parameter readerConfig: Current folio reader configuration. @@ -346,38 +346,38 @@ internal extension UIImage { func ignoreSystemTint(withConfiguration readerConfig: FolioReaderConfig) -> UIImage? { return self.imageTintColor(readerConfig.tintColor)?.withRenderingMode(.alwaysOriginal) } - + /** Colorize the image with a color - + - parameter tintColor: The input color - returns: Returns a colored image */ func imageTintColor(_ tintColor: UIColor) -> UIImage? { UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale) - + let context = UIGraphicsGetCurrentContext() context?.translateBy(x: 0, y: self.size.height) context?.scaleBy(x: 1.0, y: -1.0) context?.setBlendMode(CGBlendMode.normal) - + let rect = CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height) as CGRect if let cgImage = self.cgImage { context?.clip(to: rect, mask: cgImage) } - + tintColor.setFill() context?.fill(rect) - + let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() - + return newImage } - + /** Generate a image with a color - + - parameter color: The input color - returns: Returns a colored image */ @@ -385,23 +385,23 @@ internal extension UIImage { let rect = CGRect(x: 0.0, y: 0.0, width: 1.0, height: 1.0) UIGraphicsBeginImageContextWithOptions(rect.size, false, 0) let context = UIGraphicsGetCurrentContext() - + if let color = color { color.setFill() } else { UIColor.white.setFill() } - + context!.fill(rect) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() - + return image! } - + /** Generates a image with a `CALayer` - + - parameter layer: The input `CALayer` - returns: Return a rendered image */ @@ -412,10 +412,10 @@ internal extension UIImage { UIGraphicsEndImageContext() return img! } - + /** Generates a image from a `UIView` - + - parameter view: The input `UIView` - returns: Return a rendered image */ @@ -429,16 +429,16 @@ internal extension UIImage { } internal extension UIViewController { - + func setCloseButton(withConfiguration readerConfig: FolioReaderConfig) { let closeImage = UIImage(readerImageNamed: "icon-navbar-close")?.ignoreSystemTint(withConfiguration: readerConfig) self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: closeImage, style: .plain, target: self, action: #selector(dismiss as () -> Void)) } - + @objc func dismiss() { self.dismiss(nil) } - + func dismiss(_ completion: (() -> Void)?) { DispatchQueue.main.async { self.dismiss(animated: true, completion: { @@ -446,65 +446,56 @@ internal extension UIViewController { }) } } - + // MARK: - NavigationBar - + func setTransparentNavigation() { let navBar = self.navigationController?.navigationBar navBar?.setBackgroundImage(UIImage(), for: UIBarMetrics.default) - navBar?.hideBottomHairline() + navBar?.isHidden = true navBar?.isTranslucent = true } - + func setTranslucentNavigation(_ translucent: Bool = true, color: UIColor, tintColor: UIColor = UIColor.white, titleColor: UIColor = UIColor.black, andFont font: UIFont = UIFont.systemFont(ofSize: 17)) { let navBar = self.navigationController?.navigationBar navBar?.setBackgroundImage(UIImage.imageWithColor(color), for: UIBarMetrics.default) - navBar?.showBottomHairline() + navBar?.isHidden = false navBar?.isTranslucent = translucent navBar?.tintColor = tintColor navBar?.titleTextAttributes = [NSAttributedStringKey.foregroundColor: titleColor, NSAttributedStringKey.font: font] } } +/** + Fix for Swift 4 / iOS 12 + https://stackoverflow.com/questions/34452920/removing-the-hairline-under-navigation-bar + */ +private var navigationBarHairLine: UIImageView? -internal extension UINavigationBar { - - func hideBottomHairline() { - let navigationBarImageView = hairlineImageViewInNavigationBar(self) - navigationBarImageView!.isHidden = true - } - - func showBottomHairline() { - let navigationBarImageView = hairlineImageViewInNavigationBar(self) - navigationBarImageView!.isHidden = false +func findHairlineImageViewUnderView(view: UIView?) -> UIImageView? { + guard let view = view else { return nil } + if view.isKind(of: UIImageView.classForCoder()) && view.bounds.height <= 1 { + return view as? UIImageView } - - fileprivate func hairlineImageViewInNavigationBar(_ view: UIView) -> UIImageView? { - if view.isKind(of: UIImageView.self) && view.bounds.height <= 1.0 { - return (view as! UIImageView) + for subView in view.subviews { + if let imageView = findHairlineImageViewUnderView(view: subView) { + return imageView } - - let subviews = (view.subviews) - for subview: UIView in subviews { - if let imageView: UIImageView = hairlineImageViewInNavigationBar(subview) { - return imageView - } - } - return nil } + return nil } extension UINavigationController { - + open override var preferredStatusBarStyle : UIStatusBarStyle { guard let viewController = visibleViewController else { return .default } return viewController.preferredStatusBarStyle } - + open override var supportedInterfaceOrientations : UIInterfaceOrientationMask { guard let viewController = visibleViewController else { return .portrait } return viewController.supportedInterfaceOrientations } - + open override var shouldAutorotate : Bool { guard let viewController = visibleViewController else { return false } return viewController.shouldAutorotate From 3e99c2e1bba1efc29d8270dc3b7bceb2ace571bd Mon Sep 17 00:00:00 2001 From: fantim Date: Sat, 12 Jan 2019 17:04:26 +0800 Subject: [PATCH 08/14] Updated dependencies to latest to work with Xcode 10.1 on iOS 12.1 --- Cartfile | 2 +- Cartfile.resolved | 2 +- Example/Podfile.lock | 18 +++++++++--------- FolioReaderKit.podspec | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cartfile b/Cartfile index d03518979..5ef173497 100644 --- a/Cartfile +++ b/Cartfile @@ -4,4 +4,4 @@ github "alexpopov/ZFDragableModalTransition" "merge-carthage-into-zoonooz" github "tadija/AEXML" == 4.3.3 github "ArtSabintsev/FontBlaster" == 4.1.0 github "jessesquires/JSQWebViewController" == 6.0.0 -github "realm/realm-cocoa" == 3.13.0 +github "realm/realm-cocoa" == 3.13.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 43f7c7ec7..92d853ca2 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -3,5 +3,5 @@ github "ZipArchive/ZipArchive" "v2.1.1" github "alexpopov/ZFDragableModalTransition" "8da951efb4202385630d1cf7104b60d1208f807e" github "cxa/MenuItemKit" "3.1.3" github "jessesquires/JSQWebViewController" "6.0.0" -github "realm/realm-cocoa" "v3.13.0" +github "realm/realm-cocoa" "v3.13.1" github "tadija/AEXML" "4.3.3" diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 4e6e58e52..d735141fa 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -5,7 +5,7 @@ PODS: - FontBlaster (= 4.1.0) - JSQWebViewController (= 6.0.0) - MenuItemKit (= 3.1.3) - - RealmSwift (= 3.13.0) + - RealmSwift (= 3.13.1) - SSZipArchive (= 2.1.1) - ZFDragableModalTransition (= 0.6) - FontBlaster (4.1.0) @@ -13,11 +13,11 @@ PODS: - MenuItemKit (3.1.3) - Nimble (7.3.1) - Quick (1.3.2) - - Realm (3.13.0): - - Realm/Headers (= 3.13.0) - - Realm/Headers (3.13.0) - - RealmSwift (3.13.0): - - Realm (= 3.13.0) + - Realm (3.13.1): + - Realm/Headers (= 3.13.1) + - Realm/Headers (3.13.1) + - RealmSwift (3.13.1): + - Realm (= 3.13.1) - SSZipArchive (2.1.1) - ZFDragableModalTransition (0.6) @@ -45,14 +45,14 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AEXML: 601f41fcaa7bda7605cad153b0f43db9ec006c0f - FolioReaderKit: 7a39d9d1f422b2ea0fa1ab36ca1c817e30821df8 + FolioReaderKit: ff4077dd4335f0aefab008f742029df908cbe225 FontBlaster: 127aa66419478d1c62926c7fdb39841633344a45 JSQWebViewController: 51041569b75d19dbb6b7fe0b7ae053c32409a9be MenuItemKit: 0f850e630b0a3d2bd80fec54db87ce0d2077ada2 Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae Quick: 2623cb30d7a7f41ca62f684f679586558f483d46 - Realm: 5edd2ee65406aef591a4f9895de5a3440e51b3d8 - RealmSwift: be5ebc7930e37cd3376b41cec7f21984528aaa16 + Realm: 50071da38fe079e0735e47c9f2eae738c68c5996 + RealmSwift: 8a1e6a02b7a08cd17a31e3115143fb69fe5f3fb9 SSZipArchive: 14401ade5f8e82aba1ff03e9f88e9de60937ae60 ZFDragableModalTransition: 0d294eaaba6edfcb9839595de765f9ca06a4b524 diff --git a/FolioReaderKit.podspec b/FolioReaderKit.podspec index a249fcee0..4498f60e8 100755 --- a/FolioReaderKit.podspec +++ b/FolioReaderKit.podspec @@ -36,6 +36,6 @@ Pod::Spec.new do |s| s.dependency 'AEXML', '4.3.3' s.dependency 'FontBlaster', '4.1.0' s.dependency 'JSQWebViewController', '6.0.0' - s.dependency 'RealmSwift', '3.13.0' + s.dependency 'RealmSwift', '3.13.1' end From 457dcd2b794d92f25e312567bda75e3876d7b7e6 Mon Sep 17 00:00:00 2001 From: fantim Date: Tue, 22 Jan 2019 20:29:31 -0800 Subject: [PATCH 09/14] Conversion to Swift 4.2 and fixed FolioReaderAudioPlayer AudioIssue --- Example/Example.xcodeproj/project.pbxproj | 8 +++-- Example/Example/AppDelegate.swift | 2 +- .../FolioReaderTests/FolioReaderTests.swift | 4 +-- .../SharingProviderTests.swift | 4 +-- Source/Extensions.swift | 10 +++--- Source/FolioReaderAddHighlightNote.swift | 10 +++--- Source/FolioReaderAudioPlayer.swift | 25 +++++++++++++-- Source/FolioReaderCenter.swift | 22 ++++++------- Source/FolioReaderChapterList.swift | 4 +-- Source/FolioReaderChapterListCell.swift | 2 +- Source/FolioReaderConfig.swift | 2 +- Source/FolioReaderContainer.swift | 8 ++--- Source/FolioReaderFontsMenu.swift | 6 ++-- Source/FolioReaderHighlightList.swift | 28 ++++++++-------- Source/FolioReaderKit.swift | 8 ++--- Source/FolioReaderPage.swift | 4 +-- Source/FolioReaderPageIndicator.swift | 4 +-- Source/FolioReaderPlayerMenu.swift | 32 +++++++++---------- Source/FolioReaderQuoteShare.swift | 29 ++++++++++++----- Source/FolioReaderSharingProvider.swift | 8 ++--- Source/FolioReaderWebView.swift | 4 +-- Source/Models/Highlight.swift | 2 +- Source/PageViewController.swift | 8 ++--- Source/ScrollScrubber.swift | 4 +-- Vendor/HAControls/HADiscreteSlider.swift | 2 +- Vendor/SMSegmentView/SMSegment.swift | 6 ++-- 26 files changed, 141 insertions(+), 105 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 46b881672..ec0929dac 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -376,7 +376,7 @@ 1A42C2881C0E3882000F2137 = { CreatedOnToolsVersion = 7.1.1; DevelopmentTeam = 32F2T8EJ6G; - LastSwiftMigration = 0800; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.BackgroundModes = { @@ -391,7 +391,7 @@ CA10C1301C572A4B0049165D = { CreatedOnToolsVersion = 7.3; DevelopmentTeam = 99AHAA343Q; - LastSwiftMigration = 0800; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; TestTargetID = 1A42C2881C0E3882000F2137; }; @@ -935,6 +935,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -952,6 +953,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -1004,6 +1006,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Debug; @@ -1021,6 +1024,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Release; diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index de59f6302..5f7c19150 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -13,7 +13,7 @@ import FolioReaderKit class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } } diff --git a/Example/FolioReaderTests/FolioReaderTests.swift b/Example/FolioReaderTests/FolioReaderTests.swift index 09243d3d4..d411405c4 100644 --- a/Example/FolioReaderTests/FolioReaderTests.swift +++ b/Example/FolioReaderTests/FolioReaderTests.swift @@ -50,8 +50,8 @@ class FolioReaderTests: QuickSpec { do { let parsedImage = try subject.parseCoverImage(epubPath) - let data1 = UIImagePNGRepresentation(parsedImage) - let data2 = UIImagePNGRepresentation(fromFileImage) + let data1 = parsedImage.pngData() + let data2 = fromFileImage.pngData() expect(data1).to(equal(data2)) } catch { fail("Error: \(error.localizedDescription)") diff --git a/Example/FolioReaderTests/SharingProviderTests.swift b/Example/FolioReaderTests/SharingProviderTests.swift index 02717d0f7..6fc6f14bf 100644 --- a/Example/FolioReaderTests/SharingProviderTests.swift +++ b/Example/FolioReaderTests/SharingProviderTests.swift @@ -30,7 +30,7 @@ class SharingProviderTests: QuickSpec { } it("returns text for a mail activity") { - let itemForActivityType = subject.activityViewController(activityViewController, itemForActivityType: UIActivityType.mail) as? String + let itemForActivityType = subject.activityViewController(activityViewController, itemForActivityType: UIActivity.ActivityType.mail) as? String expect(itemForActivityType).to(equal(subject.text)) } } @@ -41,7 +41,7 @@ class SharingProviderTests: QuickSpec { } it("returns HTML for a mail activity") { - let itemForActivityType = subject.activityViewController(activityViewController, itemForActivityType: UIActivityType.mail) as? String + let itemForActivityType = subject.activityViewController(activityViewController, itemForActivityType: UIActivity.ActivityType.mail) as? String expect(itemForActivityType).to(equal(subject.html)) } } diff --git a/Source/Extensions.swift b/Source/Extensions.swift index 81f0bc69c..15c2612b3 100644 --- a/Source/Extensions.swift +++ b/Source/Extensions.swift @@ -9,14 +9,14 @@ import Foundation import UIKit -extension UICollectionViewScrollDirection { - static func direction(withConfiguration readerConfig: FolioReaderConfig) -> UICollectionViewScrollDirection { +extension UICollectionView.ScrollDirection { + static func direction(withConfiguration readerConfig: FolioReaderConfig) -> UICollectionView.ScrollDirection { return readerConfig.isDirection(.vertical, .horizontal, .horizontal) } } -extension UICollectionViewScrollPosition { - static func direction(withConfiguration readerConfig: FolioReaderConfig) -> UICollectionViewScrollPosition { +extension UICollectionView.ScrollPosition { + static func direction(withConfiguration readerConfig: FolioReaderConfig) -> UICollectionView.ScrollPosition { return readerConfig.isDirection(.top, .left, .left) } } @@ -462,7 +462,7 @@ internal extension UIViewController { navBar?.isHidden = false navBar?.isTranslucent = translucent navBar?.tintColor = tintColor - navBar?.titleTextAttributes = [NSAttributedStringKey.foregroundColor: titleColor, NSAttributedStringKey.font: font] + navBar?.titleTextAttributes = [NSAttributedString.Key.foregroundColor: titleColor, NSAttributedString.Key.font: font] } } /** diff --git a/Source/FolioReaderAddHighlightNote.swift b/Source/FolioReaderAddHighlightNote.swift index 754b8f760..519a203b1 100644 --- a/Source/FolioReaderAddHighlightNote.swift +++ b/Source/FolioReaderAddHighlightNote.swift @@ -136,21 +136,21 @@ class FolioReaderAddHighlightNote: UIViewController { let font = UIFont(name: "Avenir-Light", size: 17)! setTranslucentNavigation(false, color: navBackground, tintColor: tintColor, titleColor: navText, andFont: font) - let titleAttrs = [NSAttributedStringKey.foregroundColor: readerConfig.tintColor] + let titleAttrs = [NSAttributedString.Key.foregroundColor: readerConfig.tintColor] let saveButton = UIBarButtonItem(title: readerConfig.localizedSave, style: .plain, target: self, action: #selector(saveNote(_:))) - saveButton.setTitleTextAttributes(titleAttrs, for: UIControlState()) + saveButton.setTitleTextAttributes(titleAttrs, for: UIControl.State()) navigationItem.rightBarButtonItem = saveButton } private func configureKeyboardObserver() { - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name:NSNotification.Name.UIKeyboardWillShow, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name:NSNotification.Name.UIKeyboardWillHide, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name:UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name:UIResponder.keyboardWillHideNotification, object: nil) } @objc private func keyboardWillShow(notification: NSNotification){ //give room at the bottom of the scroll view, so it doesn't cover up anything the user needs to tap var userInfo = notification.userInfo! - var keyboardFrame:CGRect = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue + var keyboardFrame:CGRect = (userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue keyboardFrame = self.view.convert(keyboardFrame, from: nil) var contentInset:UIEdgeInsets = self.scrollView.contentInset diff --git a/Source/FolioReaderAudioPlayer.swift b/Source/FolioReaderAudioPlayer.swift index a7b3c5bce..053fc929f 100644 --- a/Source/FolioReaderAudioPlayer.swift +++ b/Source/FolioReaderAudioPlayer.swift @@ -41,12 +41,26 @@ open class FolioReaderAudioPlayer: NSObject { UIApplication.shared.beginReceivingRemoteControlEvents() // this is needed to the audio can play even when the "silent/vibrate" toggle is on + // Fix for AVudioSession https://stackoverflow.com/questions/51010390/avaudiosession-setcategory-swift-4-2-ios-12-play-sound-on-silent + let session = AVAudioSession.sharedInstance() - try? session.setCategory(AVAudioSessionCategoryPlayback) + do { + if #available(iOS 10.0, *) { + try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) + } else { + // Fallback on earlier versions +// Workaround until https://forums.swift.org/t/using-methods-marked-unavailable-in-swift-4-2/14949 isn't fixed + AVAudioSession.sharedInstance().perform(NSSelectorFromString("setCategory:error:"), with: AVAudioSession.Category.playback) + } + try AVAudioSession.sharedInstance().setActive(true) + } catch { + print(error) + } +// try? session.setCategory(convertFromAVAudioSessionCategory(AVAudioSession.Category.playback)) NotificationCenter.default.addObserver(self, selector: #selector(pause), - name: .AVAudioSessionInterruption, + name: AVAudioSession.interruptionNotification, object: session ) @@ -411,7 +425,7 @@ open class FolioReaderAudioPlayer: NSObject { fileprivate func startPlayerTimer() { // we must add the timer in this mode in order for it to continue working even when the user is scrolling a webview playingTimer = Timer(timeInterval: 0.01, target: self, selector: #selector(playerTimerObserver), userInfo: nil, repeats: true) - RunLoop.current.add(playingTimer, forMode: RunLoopMode.commonModes) + RunLoop.current.add(playingTimer, forMode: RunLoop.Mode.common) } fileprivate func stopPlayerTimer() { @@ -538,3 +552,8 @@ extension FolioReaderAudioPlayer: AVAudioPlayerDelegate { _playFragment(self.nextAudioFragment()) } } + +// Helper function inserted by Swift 4.2 migrator. +fileprivate func convertFromAVAudioSessionCategory(_ input: AVAudioSession.Category) -> String { + return input.rawValue +} diff --git a/Source/FolioReaderCenter.swift b/Source/FolioReaderCenter.swift index a50e20225..a0b01af66 100644 --- a/Source/FolioReaderCenter.swift +++ b/Source/FolioReaderCenter.swift @@ -119,8 +119,8 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl self.totalPages = book.spine.spineReferences.count // Loading indicator - let style: UIActivityIndicatorViewStyle = folioReader.isNight(.white, .gray) - loadingView = UIActivityIndicatorView(activityIndicatorStyle: style) + let style: UIActivityIndicatorView.Style = folioReader.isNight(.white, .gray) + loadingView = UIActivityIndicatorView(style: style) loadingView.hidesWhenStopped = true loadingView.startAnimating() self.view.addSubview(loadingView) @@ -153,7 +153,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl collectionView.showsVerticalScrollIndicator = false collectionView.showsHorizontalScrollIndicator = false collectionView.backgroundColor = background - collectionView.decelerationRate = UIScrollViewDecelerationRateFast + collectionView.decelerationRate = UIScrollView.DecelerationRate.fast enableScrollBetweenChapters(scrollEnabled: true) view.addSubview(collectionView) @@ -162,12 +162,12 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl } // Activity Indicator - self.activityIndicator.activityIndicatorViewStyle = .gray + self.activityIndicator.style = .gray self.activityIndicator.hidesWhenStopped = true self.activityIndicator = UIActivityIndicatorView(frame: CGRect(x: screenBounds.size.width/2, y: screenBounds.size.height/2, width: 30, height: 30)) self.activityIndicator.backgroundColor = UIColor.gray self.view.addSubview(self.activityIndicator) - self.view.bringSubview(toFront: self.activityIndicator) + self.view.bringSubviewToFront(self.activityIndicator) if #available(iOS 10.0, *) { collectionView.isPrefetchingEnabled = false @@ -595,7 +595,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl return } - self.collectionView.scrollToItem(at: IndexPath(row: self.currentPageNumber - 1, section: 0), at: UICollectionViewScrollPosition(), animated: false) + self.collectionView.scrollToItem(at: IndexPath(row: self.currentPageNumber - 1, section: 0), at: UICollectionView.ScrollPosition(), animated: false) if (self.currentPageNumber + 1) >= totalPages { UIView.animate(withDuration: duration, animations: { self.collectionView.setContentOffset(self.frameForPage(self.currentPageNumber).origin, animated: false) @@ -772,7 +772,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl return } - UIView.animate(withDuration: animated ? 0.3 : 0, delay: 0, options: UIViewAnimationOptions(), animations: { () -> Void in + UIView.animate(withDuration: animated ? 0.3 : 0, delay: 0, options: UIView.AnimationOptions(), animations: { () -> Void in self.collectionView.scrollToItem(at: indexPath, at: .direction(withConfiguration: self.readerConfig), animated: false) }) { (finished: Bool) -> Void in completion?() @@ -942,7 +942,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl contentOffsetX = 0 } - UIView.animate(withDuration: animated ? 0.3 : 0, delay: 0, options: UIViewAnimationOptions(), animations: { () -> Void in + UIView.animate(withDuration: animated ? 0.3 : 0, delay: 0, options: UIView.AnimationOptions(), animations: { () -> Void in cell.scrollPageToOffset(contentOffsetX, animated: animated) }) { (finished: Bool) -> Void in self.updateCurrentPage { @@ -1120,7 +1120,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl shareItems.insert(contentsOf: [act, "" as AnyObject], at: 0) let activityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil) - activityViewController.excludedActivityTypes = [UIActivityType.print, UIActivityType.postToVimeo] + activityViewController.excludedActivityTypes = [UIActivity.ActivityType.print, UIActivity.ActivityType.postToVimeo] // Pop style on iPad if let actv = activityViewController.popoverPresentationController { @@ -1179,7 +1179,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl shareItems.insert(contentsOf: [act, "" as AnyObject], at: 0) let activityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil) - activityViewController.excludedActivityTypes = [UIActivityType.print, UIActivityType.postToVimeo] + activityViewController.excludedActivityTypes = [UIActivity.ActivityType.print, UIActivity.ActivityType.postToVimeo] // Pop style on iPad if let actv = activityViewController.popoverPresentationController { @@ -1295,7 +1295,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl open func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { recentlyScrolledTimer = Timer(timeInterval:recentlyScrolledDelay, target: self, selector: #selector(FolioReaderCenter.clearRecentlyScrolled), userInfo: nil, repeats: false) - RunLoop.current.add(recentlyScrolledTimer, forMode: RunLoopMode.commonModes) + RunLoop.current.add(recentlyScrolledTimer, forMode: RunLoop.Mode.common) } @objc func clearRecentlyScrolled() { diff --git a/Source/FolioReaderChapterList.swift b/Source/FolioReaderChapterList.swift index bdf27ca1d..be6076d84 100755 --- a/Source/FolioReaderChapterList.swift +++ b/Source/FolioReaderChapterList.swift @@ -35,7 +35,7 @@ class FolioReaderChapterList: UITableViewController { self.delegate = delegate self.book = book - super.init(style: UITableViewStyle.plain) + super.init(style: UITableView.Style.plain) } required init?(coder aDecoder: NSCoder) { @@ -51,7 +51,7 @@ class FolioReaderChapterList: UITableViewController { self.tableView.backgroundColor = self.folioReader.isNight(self.readerConfig.nightModeMenuBackground, self.readerConfig.menuBackgroundColor) self.tableView.separatorColor = self.folioReader.isNight(self.readerConfig.nightModeSeparatorColor, self.readerConfig.menuSeparatorColor) - self.tableView.rowHeight = UITableViewAutomaticDimension + self.tableView.rowHeight = UITableView.automaticDimension self.tableView.estimatedRowHeight = 50 // Create TOC list diff --git a/Source/FolioReaderChapterListCell.swift b/Source/FolioReaderChapterListCell.swift index 75f2f7f87..733d9ee57 100755 --- a/Source/FolioReaderChapterListCell.swift +++ b/Source/FolioReaderChapterListCell.swift @@ -11,7 +11,7 @@ import UIKit class FolioReaderChapterListCell: UITableViewCell { var indexLabel: UILabel? - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) self.indexLabel = UILabel() diff --git a/Source/FolioReaderConfig.swift b/Source/FolioReaderConfig.swift index 033772f3e..1f35ed71e 100755 --- a/Source/FolioReaderConfig.swift +++ b/Source/FolioReaderConfig.swift @@ -27,7 +27,7 @@ public enum FolioReaderScrollDirection: Int { /// The current scroll direction /// /// - Returns: Returns `UICollectionViewScrollDirection` - func collectionViewScrollDirection() -> UICollectionViewScrollDirection { + func collectionViewScrollDirection() -> UICollectionView.ScrollDirection { switch self { case .vertical, .defaultVertical: return .vertical diff --git a/Source/FolioReaderContainer.swift b/Source/FolioReaderContainer.swift index 76277aa42..66dc08b10 100755 --- a/Source/FolioReaderContainer.swift +++ b/Source/FolioReaderContainer.swift @@ -138,9 +138,9 @@ open class FolioReaderContainer: UIViewController { self.centerNavigationController?.setNavigationBarHidden(self.readerConfig.shouldHideNavigationOnTap, animated: false) if let _centerNavigationController = self.centerNavigationController { self.view.addSubview(_centerNavigationController.view) - self.addChildViewController(_centerNavigationController) + self.addChild(_centerNavigationController) } - self.centerNavigationController?.didMove(toParentViewController: self) + self.centerNavigationController?.didMove(toParent: self) if (self.readerConfig.hideBars == true) { self.readerConfig.shouldHideNavigationOnTap = false @@ -215,9 +215,9 @@ extension FolioReaderContainer { let alertController = UIAlertController( title: "Error", message: message, - preferredStyle: UIAlertControllerStyle.alert + preferredStyle: UIAlertController.Style.alert ) - let action = UIAlertAction(title: "OK", style: UIAlertActionStyle.cancel) { [weak self] + let action = UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel) { [weak self] (result : UIAlertAction) -> Void in self?.dismiss() } diff --git a/Source/FolioReaderFontsMenu.swift b/Source/FolioReaderFontsMenu.swift index aec858504..e87a6b392 100644 --- a/Source/FolioReaderFontsMenu.swift +++ b/Source/FolioReaderFontsMenu.swift @@ -198,7 +198,7 @@ class FolioReaderFontsMenu: UIViewController, SMSegmentViewDelegate, UIGestureRe slider.tintColor = self.readerConfig.nightModeSeparatorColor slider.minimumValue = 0 slider.value = CGFloat(self.folioReader.currentFontSize.rawValue) - slider.addTarget(self, action: #selector(FolioReaderFontsMenu.sliderValueChanged(_:)), for: UIControlEvents.valueChanged) + slider.addTarget(self, action: #selector(FolioReaderFontsMenu.sliderValueChanged(_:)), for: UIControl.Event.valueChanged) // Force remove fill color slider.layer.sublayers?.forEach({ layer in @@ -210,12 +210,12 @@ class FolioReaderFontsMenu: UIViewController, SMSegmentViewDelegate, UIGestureRe // Font icons let fontSmallView = UIImageView(frame: CGRect(x: 20, y: line2.frame.origin.y+14, width: 30, height: 30)) fontSmallView.image = fontSmallNormal - fontSmallView.contentMode = UIViewContentMode.center + fontSmallView.contentMode = UIView.ContentMode.center menuView.addSubview(fontSmallView) let fontBigView = UIImageView(frame: CGRect(x: view.frame.width-50, y: line2.frame.origin.y+14, width: 30, height: 30)) fontBigView.image = fontBigNormal - fontBigView.contentMode = UIViewContentMode.center + fontBigView.contentMode = UIView.ContentMode.center menuView.addSubview(fontBigView) // Only continues if user can change scroll direction diff --git a/Source/FolioReaderHighlightList.swift b/Source/FolioReaderHighlightList.swift index 3ba7763fe..593c167d0 100644 --- a/Source/FolioReaderHighlightList.swift +++ b/Source/FolioReaderHighlightList.swift @@ -18,7 +18,7 @@ class FolioReaderHighlightList: UITableViewController { self.readerConfig = readerConfig self.folioReader = folioReader - super.init(style: UITableViewStyle.plain) + super.init(style: UITableView.Style.plain) } required init?(coder aDecoder: NSCoder) { @@ -67,7 +67,7 @@ class FolioReaderHighlightList: UITableViewController { if cell.contentView.viewWithTag(456) == nil { dateLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.frame.width-40, height: 16)) dateLabel.tag = 456 - dateLabel.autoresizingMask = UIViewAutoresizing.flexibleWidth + dateLabel.autoresizingMask = UIView.AutoresizingMask.flexibleWidth dateLabel.font = UIFont(name: "Avenir-Medium", size: 12) cell.contentView.addSubview(dateLabel) } else { @@ -86,16 +86,16 @@ class FolioReaderHighlightList: UITableViewController { paragraph.lineSpacing = 3 let textColor = self.folioReader.isNight(self.readerConfig.menuTextColor, UIColor.black) - text.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraph, range: range) - text.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) - text.addAttribute(NSAttributedStringKey.foregroundColor, value: textColor, range: range) + text.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraph, range: range) + text.addAttribute(NSAttributedString.Key.font, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) + text.addAttribute(NSAttributedString.Key.foregroundColor, value: textColor, range: range) if (highlight.type == HighlightStyle.underline.rawValue) { - text.addAttribute(NSAttributedStringKey.backgroundColor, value: UIColor.clear, range: range) - text.addAttribute(NSAttributedStringKey.underlineColor, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) - text.addAttribute(NSAttributedStringKey.underlineStyle, value: NSNumber(value: NSUnderlineStyle.styleSingle.rawValue as Int), range: range) + text.addAttribute(NSAttributedString.Key.backgroundColor, value: UIColor.clear, range: range) + text.addAttribute(NSAttributedString.Key.underlineColor, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) + text.addAttribute(NSAttributedString.Key.underlineStyle, value: NSNumber(value: NSUnderlineStyle.single.rawValue as Int), range: range) } else { - text.addAttribute(NSAttributedStringKey.backgroundColor, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) + text.addAttribute(NSAttributedString.Key.backgroundColor, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) } // Text @@ -103,7 +103,7 @@ class FolioReaderHighlightList: UITableViewController { if cell.contentView.viewWithTag(123) == nil { highlightLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.frame.width-40, height: 0)) highlightLabel.tag = 123 - highlightLabel.autoresizingMask = UIViewAutoresizing.flexibleWidth + highlightLabel.autoresizingMask = UIView.AutoresizingMask.flexibleWidth highlightLabel.numberOfLines = 0 highlightLabel.textColor = UIColor.black cell.contentView.addSubview(highlightLabel) @@ -122,7 +122,7 @@ class FolioReaderHighlightList: UITableViewController { noteLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.frame.width-40, height: 0)) noteLabel.tag = 789 noteLabel.font = UIFont.systemFont(ofSize: 14) - noteLabel.autoresizingMask = UIViewAutoresizing.flexibleWidth + noteLabel.autoresizingMask = UIView.AutoresizingMask.flexibleWidth noteLabel.numberOfLines = 3 noteLabel.textColor = UIColor.gray cell.contentView.addSubview(noteLabel) @@ -151,8 +151,8 @@ class FolioReaderHighlightList: UITableViewController { let range = NSRange(location: 0, length: text.length) let paragraph = NSMutableParagraphStyle() paragraph.lineSpacing = 3 - text.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraph, range: range) - text.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) + text.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraph, range: range) + text.addAttribute(NSAttributedString.Key.font, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) let s = text.boundingRect(with: CGSize(width: view.frame.width-40, height: CGFloat.greatestFiniteMagnitude), options: [NSStringDrawingOptions.usesLineFragmentOrigin, NSStringDrawingOptions.usesFontLeading], @@ -184,7 +184,7 @@ class FolioReaderHighlightList: UITableViewController { self.dismiss() } - override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) { + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { guard let highlight = highlights[safe: indexPath.row] else { return } diff --git a/Source/FolioReaderKit.swift b/Source/FolioReaderKit.swift index da13130a4..96914b6ef 100755 --- a/Source/FolioReaderKit.swift +++ b/Source/FolioReaderKit.swift @@ -136,14 +136,14 @@ open class FolioReader: NSObject { // Add necessary observers fileprivate func addObservers() { removeObservers() - NotificationCenter.default.addObserver(self, selector: #selector(saveReaderState), name: .UIApplicationWillResignActive, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(saveReaderState), name: .UIApplicationWillTerminate, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(saveReaderState), name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(saveReaderState), name: UIApplication.willTerminateNotification, object: nil) } /// Remove necessary observers fileprivate func removeObservers() { - NotificationCenter.default.removeObserver(self, name: .UIApplicationWillResignActive, object: nil) - NotificationCenter.default.removeObserver(self, name: .UIApplicationWillTerminate, object: nil) + NotificationCenter.default.removeObserver(self, name: UIApplication.willResignActiveNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: UIApplication.willTerminateNotification, object: nil) } } diff --git a/Source/FolioReaderPage.swift b/Source/FolioReaderPage.swift index fa09427ff..34cc111f6 100755 --- a/Source/FolioReaderPage.swift +++ b/Source/FolioReaderPage.swift @@ -226,7 +226,7 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe delegate?.pageDidLoad?(self) } - open func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { + open func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool { guard let webView = webView as? FolioReaderWebView, let scheme = request.url?.scheme else { @@ -240,7 +240,7 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe guard let decoded = url.absoluteString.removingPercentEncoding else { return false } let index = decoded.index(decoded.startIndex, offsetBy: 12) - let rect = CGRectFromString(String(decoded[index...])) + let rect = NSCoder.cgRect(for: String(decoded[index...])) webView.createMenu(options: true) webView.setMenuVisible(true, andRect: rect) diff --git a/Source/FolioReaderPageIndicator.swift b/Source/FolioReaderPageIndicator.swift index 1e244bd96..fc1960556 100644 --- a/Source/FolioReaderPageIndicator.swift +++ b/Source/FolioReaderPageIndicator.swift @@ -75,11 +75,11 @@ class FolioReaderPageIndicator: UIView { let currentColor = UIColor(cgColor: layer.shadowColor!) animation.fromValue = currentColor.cgColor animation.toValue = color.cgColor - animation.fillMode = kCAFillModeForwards + animation.fillMode = CAMediaTimingFillMode.forwards animation.isRemovedOnCompletion = false animation.duration = 0.6 animation.delegate = self - animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) layer.add(animation, forKey: "shadowColor") minutesLabel.textColor = self.folioReader.isNight(UIColor(white: 1, alpha: 0.3), UIColor(white: 0, alpha: 0.6)) diff --git a/Source/FolioReaderPlayerMenu.swift b/Source/FolioReaderPlayerMenu.swift index af0c6bd74..8b2d24434 100644 --- a/Source/FolioReaderPlayerMenu.swift +++ b/Source/FolioReaderPlayerMenu.swift @@ -78,16 +78,16 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR // prev button let prevBtn = UIButton(frame: CGRect(x: gutterX + padX, y: 0, width: size, height: size)) - prevBtn.setImage(prevNormal, for: UIControlState()) + prevBtn.setImage(prevNormal, for: UIControl.State()) prevBtn.setImage(prevSelected, for: .selected) prevBtn.addTarget(self, action: #selector(FolioReaderPlayerMenu.prevChapter(_:)), for: .touchUpInside) menuView.addSubview(prevBtn) // play / pause button let playPauseBtn = UIButton(frame: CGRect(x: Int(prevBtn.frame.origin.x) + padX + size, y: 0, width: size, height: size)) - playPauseBtn.setTitleColor(selectedColor, for: UIControlState()) + playPauseBtn.setTitleColor(selectedColor, for: UIControl.State()) playPauseBtn.setTitleColor(selectedColor, for: .selected) - playPauseBtn.setImage(playSelected, for: UIControlState()) + playPauseBtn.setImage(playSelected, for: UIControl.State()) playPauseBtn.setImage(pauseSelected, for: .selected) playPauseBtn.titleLabel!.font = UIFont(name: "Avenir", size: 22)! playPauseBtn.addTarget(self, action: #selector(FolioReaderPlayerMenu.togglePlay(_:)), for: .touchUpInside) @@ -99,7 +99,7 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR // next button let nextBtn = UIButton(frame: CGRect(x: Int(playPauseBtn.frame.origin.x) + padX + size, y: 0, width: size, height: size)) - nextBtn.setImage(nextNormal, for: UIControlState()) + nextBtn.setImage(nextNormal, for: UIControl.State()) nextBtn.setImage(nextSelected, for: .selected) nextBtn.addTarget(self, action: #selector(FolioReaderPlayerMenu.nextChapter(_:)), for: .touchUpInside) menuView.addSubview(nextBtn) @@ -142,9 +142,9 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR let style0 = UIButton(frame: CGRect(x: 0, y: line2.frame.height+line2.frame.origin.y, width: view.frame.width/3, height: 55)) style0.titleLabel!.textAlignment = .center style0.titleLabel!.font = UIFont(name: "Avenir-Light", size: 17) - style0.setTitleColor(self.folioReader.isNight(self.readerConfig.nightModeMenuBackground, UIColor.white), for: UIControlState()) + style0.setTitleColor(self.folioReader.isNight(self.readerConfig.nightModeMenuBackground, UIColor.white), for: UIControl.State()) style0.setTitleColor(self.folioReader.isNight(self.readerConfig.nightModeMenuBackground, UIColor.white), for: .selected) - style0.setTitle(self.readerConfig.localizedPlayerMenuStyle, for: UIControlState()) + style0.setTitle(self.readerConfig.localizedPlayerMenuStyle, for: UIControl.State()) menuView.addSubview(style0); style0.titleLabel?.sizeToFit() let style0Bgd = UIView(frame: style0.titleLabel!.frame) @@ -159,25 +159,25 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR let style1 = UIButton(frame: CGRect(x: view.frame.width/3, y: line2.frame.height+line2.frame.origin.y, width: view.frame.width/3, height: 55)) style1.titleLabel!.textAlignment = .center style1.titleLabel!.font = UIFont(name: "Avenir-Light", size: 17) - style1.setTitleColor(normalColor, for: UIControlState()) + style1.setTitleColor(normalColor, for: UIControl.State()) style1.setAttributedTitle(NSAttributedString(string: "Style", attributes: [ - NSAttributedStringKey.foregroundColor: normalColor, - NSAttributedStringKey.underlineStyle: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.styleSingle.rawValue, - NSAttributedStringKey.underlineColor: normalColor - ]), for: UIControlState()) + NSAttributedString.Key.foregroundColor: normalColor, + NSAttributedString.Key.underlineStyle: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.single.rawValue, + NSAttributedString.Key.underlineColor: normalColor + ]), for: UIControl.State()) style1.setAttributedTitle(NSAttributedString(string: self.readerConfig.localizedPlayerMenuStyle, attributes: [ - NSAttributedStringKey.foregroundColor: self.folioReader.isNight(UIColor.white, UIColor.black), - NSAttributedStringKey.underlineStyle: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.styleSingle.rawValue, - NSAttributedStringKey.underlineColor: selectedColor + NSAttributedString.Key.foregroundColor: self.folioReader.isNight(UIColor.white, UIColor.black), + NSAttributedString.Key.underlineStyle: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.single.rawValue, + NSAttributedString.Key.underlineColor: selectedColor ]), for: .selected) menuView.addSubview(style1); let style2 = UIButton(frame: CGRect(x: view.frame.width/1.5, y: line2.frame.height+line2.frame.origin.y, width: view.frame.width/3, height: 55)) style2.titleLabel!.textAlignment = .center style2.titleLabel!.font = UIFont(name: "Avenir-Light", size: 17) - style2.setTitleColor(normalColor, for: UIControlState()) + style2.setTitleColor(normalColor, for: UIControl.State()) style2.setTitleColor(selectedColor, for: .selected) - style2.setTitle(self.readerConfig.localizedPlayerMenuStyle, for: UIControlState()) + style2.setTitle(self.readerConfig.localizedPlayerMenuStyle, for: UIControl.State()) menuView.addSubview(style2); // add line dividers between style buttons diff --git a/Source/FolioReaderQuoteShare.swift b/Source/FolioReaderQuoteShare.swift index f93842a84..e76f12a56 100644 --- a/Source/FolioReaderQuoteShare.swift +++ b/Source/FolioReaderQuoteShare.swift @@ -53,9 +53,9 @@ class FolioReaderQuoteShare: UIViewController { self.setCloseButton(withConfiguration: self.readerConfig) configureNavBar() - let titleAttrs = [NSAttributedStringKey.foregroundColor: self.readerConfig.tintColor] + let titleAttrs = [NSAttributedString.Key.foregroundColor: self.readerConfig.tintColor] let share = UIBarButtonItem(title: self.readerConfig.localizedShare, style: .plain, target: self, action: #selector(shareQuote(_:))) - share.setTitleTextAttributes(titleAttrs, for: UIControlState()) + share.setTitleTextAttributes(titleAttrs, for: UIControl.State()) navigationItem.rightBarButtonItem = share let isPad = (UIDevice.current.userInterfaceIdiom == .pad) @@ -108,10 +108,10 @@ class FolioReaderQuoteShare: UIViewController { filterImage.addSubview(titleLabel) // Attributed author - let attrs = [NSAttributedStringKey.font: UIFont(name: "Lato-Italic", size: 15)!] + let attrs = [NSAttributedString.Key.font: UIFont(name: "Lato-Italic", size: 15)!] let attributedString = NSMutableAttributedString(string:"\(self.readerConfig.localizedShareBy) ", attributes: attrs) - let attrs1 = [NSAttributedStringKey.font: UIFont(name: "Lato-Regular", size: 15)!] + let attrs1 = [NSAttributedString.Key.font: UIFont(name: "Lato-Regular", size: 15)!] let boldString = NSMutableAttributedString(string: authorName, attributes:attrs1) attributedString.append(boldString) @@ -168,7 +168,7 @@ class FolioReaderQuoteShare: UIViewController { collectionView.dataSource = self collectionView.showsHorizontalScrollIndicator = false collectionView.backgroundColor = background - collectionView.decelerationRate = UIScrollViewDecelerationRateFast + collectionView.decelerationRate = UIScrollView.DecelerationRate.fast view.addSubview(collectionView) if (UIDevice.current.userInterfaceIdiom == .phone) { @@ -285,7 +285,7 @@ class FolioReaderQuoteShare: UIViewController { shareItems.insert(act, at: 0) let activityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil) - activityViewController.excludedActivityTypes = [UIActivityType.print, UIActivityType.postToVimeo] + activityViewController.excludedActivityTypes = [UIActivity.ActivityType.print, UIActivity.ActivityType.postToVimeo] // Pop style on iPad if let actv = activityViewController.popoverPresentationController { @@ -408,8 +408,11 @@ extension FolioReaderQuoteShare: UICollectionViewDelegate { // MARK: ImagePicker delegate extension FolioReaderQuoteShare: UIImagePickerControllerDelegate, UINavigationControllerDelegate { - func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { - if let image = info[UIImagePickerControllerEditedImage] as? UIImage { + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { +// Local variable inserted by Swift 4.2 migrator. +let info = convertFromUIImagePickerControllerInfoKeyDictionary(info) + + if let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.editedImage)] as? UIImage { let quoteImage = QuoteImage(withImage: image, alpha: 0.6, backgroundColor: UIColor.black) @@ -425,3 +428,13 @@ extension FolioReaderQuoteShare: UIImagePickerControllerDelegate, UINavigationCo self.dismiss(animated: true, completion: nil) } } + +// Helper function inserted by Swift 4.2 migrator. +fileprivate func convertFromUIImagePickerControllerInfoKeyDictionary(_ input: [UIImagePickerController.InfoKey: Any]) -> [String: Any] { + return Dictionary(uniqueKeysWithValues: input.map {key, value in (key.rawValue, value)}) +} + +// Helper function inserted by Swift 4.2 migrator. +fileprivate func convertFromUIImagePickerControllerInfoKey(_ input: UIImagePickerController.InfoKey) -> String { + return input.rawValue +} diff --git a/Source/FolioReaderSharingProvider.swift b/Source/FolioReaderSharingProvider.swift index 307bbf5db..da0fdbefe 100644 --- a/Source/FolioReaderSharingProvider.swift +++ b/Source/FolioReaderSharingProvider.swift @@ -23,16 +23,16 @@ class FolioReaderSharingProvider: UIActivityItemProvider { super.init(placeholderItem: "") } - override func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> String { + override func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String { return subject } - override func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivityType?) -> Any? { - if let html = html , activityType == UIActivityType.mail { + override func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? { + if let html = html , activityType == UIActivity.ActivityType.mail { return html } - if let image = image , activityType == UIActivityType.postToFacebook { + if let image = image , activityType == UIActivity.ActivityType.postToFacebook { return image } diff --git a/Source/FolioReaderWebView.swift b/Source/FolioReaderWebView.swift index 9711c6460..68803cdb6 100644 --- a/Source/FolioReaderWebView.swift +++ b/Source/FolioReaderWebView.swift @@ -137,7 +137,7 @@ open class FolioReaderWebView: UIWebView { do { let json = try JSONSerialization.jsonObject(with: jsonData!, options: []) as! NSArray let dic = json.firstObject as! [String: String] - let rect = CGRectFromString(dic["rect"]!) + let rect = NSCoder.cgRect(for: dic["rect"]!) guard let startOffset = dic["startOffset"] else { return } @@ -173,7 +173,7 @@ open class FolioReaderWebView: UIWebView { do { let json = try JSONSerialization.jsonObject(with: jsonData!, options: []) as! NSArray let dic = json.firstObject as! [String: String] - let rect = CGRectFromString(dic["rect"]!) + let rect = NSCoder.cgRect(for: dic["rect"]!) guard let startOffset = dic["startOffset"] else { return } guard let endOffset = dic["endOffset"] else { return } diff --git a/Source/Models/Highlight.swift b/Source/Models/Highlight.swift index 8a7a77add..36a25ecee 100644 --- a/Source/Models/Highlight.swift +++ b/Source/Models/Highlight.swift @@ -30,6 +30,6 @@ open class Highlight: Object { extension Results { func toArray(_ ofType: T.Type) -> [T] { - return flatMap { $0 as? T } + return compactMap { $0 as? T } } } diff --git a/Source/PageViewController.swift b/Source/PageViewController.swift index fcfaf6383..b445ea22c 100644 --- a/Source/PageViewController.swift +++ b/Source/PageViewController.swift @@ -39,7 +39,7 @@ class PageViewController: UIPageViewController { super.viewDidLoad() segmentedControl = UISegmentedControl(items: segmentedControlItems) - segmentedControl.addTarget(self, action: #selector(PageViewController.didSwitchMenu(_:)), for: UIControlEvents.valueChanged) + segmentedControl.addTarget(self, action: #selector(PageViewController.didSwitchMenu(_:)), for: UIControl.Event.valueChanged) segmentedControl.selectedSegmentIndex = index segmentedControl.setWidth(100, forSegmentAt: 0) segmentedControl.setWidth(100, forSegmentAt: 1) @@ -47,8 +47,8 @@ class PageViewController: UIPageViewController { viewList = [viewControllerOne, viewControllerTwo] - viewControllerOne.didMove(toParentViewController: self) - viewControllerTwo.didMove(toParentViewController: self) + viewControllerOne.didMove(toParent: self) + viewControllerTwo.didMove(toParent: self) self.delegate = self self.dataSource = self @@ -84,7 +84,7 @@ class PageViewController: UIPageViewController { @objc func didSwitchMenu(_ sender: UISegmentedControl) { self.index = sender.selectedSegmentIndex - let direction: UIPageViewControllerNavigationDirection = (index == 0 ? .reverse : .forward) + let direction: UIPageViewController.NavigationDirection = (index == 0 ? .reverse : .forward) setViewControllers([viewList[index]], direction: direction, animated: true, completion: nil) self.folioReader.currentMenuIndex = index } diff --git a/Source/ScrollScrubber.swift b/Source/ScrollScrubber.swift index 7f73b4297..10487d5c3 100644 --- a/Source/ScrollScrubber.swift +++ b/Source/ScrollScrubber.swift @@ -93,7 +93,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { // less obtrusive knob and fixes jump: http://stackoverflow.com/a/22301039/484780 let thumbImg = UIImage(readerImageNamed: "knob") let thumbImgColor = thumbImg?.imageTintColor(readerConfig.tintColor)?.withRenderingMode(.alwaysOriginal) - slider.setThumbImage(thumbImgColor, for: UIControlState()) + slider.setThumbImage(thumbImgColor, for: UIControl.State()) slider.setThumbImage(thumbImgColor, for: .selected) slider.setThumbImage(thumbImgColor, for: .highlighted) @@ -221,7 +221,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { scrollDeltaTimer = Timer(timeInterval:0.5, target: self, selector: #selector(ScrollScrubber.resetScrollDelta), userInfo: nil, repeats: false) - RunLoop.current.add(scrollDeltaTimer, forMode: RunLoopMode.commonModes) + RunLoop.current.add(scrollDeltaTimer, forMode: RunLoop.Mode.common) } @objc func resetScrollDelta() { diff --git a/Vendor/HAControls/HADiscreteSlider.swift b/Vendor/HAControls/HADiscreteSlider.swift index 8c65c5b78..5f93eff20 100644 --- a/Vendor/HAControls/HADiscreteSlider.swift +++ b/Vendor/HAControls/HADiscreteSlider.swift @@ -160,7 +160,7 @@ class HADiscreteSlider : UIControl { } func sendActionsForControlEvents() { - self.sendActions(for: UIControlEvents.valueChanged) + self.sendActions(for: UIControl.Event.valueChanged) } // MARK: HADiscreteSlider diff --git a/Vendor/SMSegmentView/SMSegment.swift b/Vendor/SMSegmentView/SMSegment.swift index e153581da..1fd67d456 100755 --- a/Vendor/SMSegmentView/SMSegment.swift +++ b/Vendor/SMSegmentView/SMSegment.swift @@ -58,7 +58,7 @@ class SMSegment: UIView { self.label.text = self.title if let titleText = self.label.text as NSString? { - self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSAttributedStringKey.font: self.label.font], context: nil).size.width + self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSAttributedString.Key.font: self.label.font], context: nil).size.width } else { self.labelWidth = 0.0 @@ -86,7 +86,7 @@ class SMSegment: UIView { self.label.font = self.titleFont if let titleText = self.label.text as NSString? { - self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width + 1.0, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSAttributedStringKey.font: self.label.font], context: nil).size.width + self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width + 1.0, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSAttributedString.Key.font: self.label.font], context: nil).size.width } else { self.labelWidth = 0.0 @@ -152,7 +152,7 @@ class SMSegment: UIView { self.backgroundColor = self.offSelectionColour - self.imageView.contentMode = UIViewContentMode.scaleAspectFit + self.imageView.contentMode = UIView.ContentMode.scaleAspectFit self.addSubview(self.imageView) self.label.textAlignment = NSTextAlignment.center From a76a403db951e872badff8e47993485a9bd451e7 Mon Sep 17 00:00:00 2001 From: fantim Date: Tue, 22 Jan 2019 20:40:14 -0800 Subject: [PATCH 10/14] updated xcode workspace --- Example/Example.xcodeproj/project.pbxproj | 10 +++++++--- .../xcshareddata/xcschemes/Example.xcscheme | 4 +--- .../xcschemes/MultipleInstance-Example.xcscheme | 4 +--- .../xcshareddata/xcschemes/Storyboard-Example.xcscheme | 4 +--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index ec0929dac..bd6ed59f6 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -370,7 +370,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = FolioReader; TargetAttributes = { 1A42C2881C0E3882000F2137 = { @@ -831,12 +831,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -863,7 +865,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.1; + IPHONEOS_DEPLOYMENT_TARGET = 11.4; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -885,12 +887,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -911,7 +915,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.1; + IPHONEOS_DEPLOYMENT_TARGET = 11.4; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index b59c9f1de..d0245a609 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme index 307bc4f3b..47fe52017 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" From 30ccc5a09b67c50a90f559af5dcec0b59e332b41 Mon Sep 17 00:00:00 2001 From: fantim Date: Thu, 24 Jan 2019 10:29:46 -0800 Subject: [PATCH 11/14] Configured project to build correctly after Swift 4.2 conversion --- Example/Example.xcodeproj/project.pbxproj | 4 ++-- Example/Podfile.lock | 2 +- FolioReaderKit.podspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index bd6ed59f6..778d5fb3c 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -870,7 +870,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -919,7 +919,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; diff --git a/Example/Podfile.lock b/Example/Podfile.lock index d735141fa..a0fdd0b9d 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -45,7 +45,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AEXML: 601f41fcaa7bda7605cad153b0f43db9ec006c0f - FolioReaderKit: ff4077dd4335f0aefab008f742029df908cbe225 + FolioReaderKit: 34276186e904dc148a6353e367d0afa46a7fbdfb FontBlaster: 127aa66419478d1c62926c7fdb39841633344a45 JSQWebViewController: 51041569b75d19dbb6b7fe0b7ae053c32409a9be MenuItemKit: 0f850e630b0a3d2bd80fec54db87ce0d2077ada2 diff --git a/FolioReaderKit.podspec b/FolioReaderKit.podspec index 4498f60e8..7c6205f39 100755 --- a/FolioReaderKit.podspec +++ b/FolioReaderKit.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/FolioReader/FolioReaderKit.git", :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/hebertialmeida' - s.swift_version = '4.0' + s.swift_version = '4.2' s.platform = :ios, '8.0' s.requires_arc = true From 19c8483eef4e56057e44fd88fcc76e18b2e15e11 Mon Sep 17 00:00:00 2001 From: fantim Date: Thu, 24 Jan 2019 11:11:44 -0800 Subject: [PATCH 12/14] Pointing JSQ to forked repo containing Swift 4.2 fix --- Cartfile | 2 +- Cartfile.resolved | 2 +- Package.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cartfile b/Cartfile index 5ef173497..77dc8ab69 100644 --- a/Cartfile +++ b/Cartfile @@ -3,5 +3,5 @@ github "cxa/MenuItemKit" == 3.1.3 github "alexpopov/ZFDragableModalTransition" "merge-carthage-into-zoonooz" github "tadija/AEXML" == 4.3.3 github "ArtSabintsev/FontBlaster" == 4.1.0 -github "jessesquires/JSQWebViewController" == 6.0.0 +github "fantim/JSQWebViewController" == 6.0.0 github "realm/realm-cocoa" == 3.13.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 92d853ca2..2c9f6aa2f 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -2,6 +2,6 @@ github "ArtSabintsev/FontBlaster" "4.1.0" github "ZipArchive/ZipArchive" "v2.1.1" github "alexpopov/ZFDragableModalTransition" "8da951efb4202385630d1cf7104b60d1208f807e" github "cxa/MenuItemKit" "3.1.3" -github "jessesquires/JSQWebViewController" "6.0.0" +github "fantim/JSQWebViewController" "6.0.0" github "realm/realm-cocoa" "v3.13.1" github "tadija/AEXML" "4.3.3" diff --git a/Package.swift b/Package.swift index 753e81d7b..465355052 100644 --- a/Package.swift +++ b/Package.swift @@ -8,7 +8,7 @@ let package = Package( .Package(url: "https://github.com/zoonooz/ZFDragableModalTransition.git", majorVersion: 0, minor: 6), .Package(url: "https://github.com/tadija/AEXML.git", majorVersion: 4, minor: 2), .Package(url: "https://github.com/ArtSabintsev/FontBlaster.git", majorVersion: 4, minor: 0), - .Package(url: "https://github.com/jessesquires/JSQWebViewController.git", majorVersion: 6, minor: 0), + .Package(url: "https://github.com/fantim/JSQWebViewController.git", majorVersion: 6, minor: 0), .Package(url: "https://github.com/realm/realm-cocoa.git", majorVersion: 3, minor: 1), ] ) From d177bb4e9d50e33c192a6ae7182a8ba7114377c6 Mon Sep 17 00:00:00 2001 From: fantim Date: Thu, 24 Jan 2019 12:34:11 -0800 Subject: [PATCH 13/14] modified pod dependency to natively support 4.2 by using branched JSQ --- Cartfile | 2 +- Example/Example.xcodeproj/project.pbxproj | 16 ++++++++-------- Example/Podfile.lock | 10 +++++----- FolioReaderKit.podspec | 2 +- Package.swift | 2 +- Source/FolioReaderPage.swift | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cartfile b/Cartfile index 77dc8ab69..52abf6c86 100644 --- a/Cartfile +++ b/Cartfile @@ -3,5 +3,5 @@ github "cxa/MenuItemKit" == 3.1.3 github "alexpopov/ZFDragableModalTransition" "merge-carthage-into-zoonooz" github "tadija/AEXML" == 4.3.3 github "ArtSabintsev/FontBlaster" == 4.1.0 -github "fantim/JSQWebViewController" == 6.0.0 +github "fantim/JSQWebViewController" == 6.1.1 github "realm/realm-cocoa" == 3.13.1 diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 778d5fb3c..d8af943f9 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -549,7 +549,7 @@ "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", - "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewControllerMod42/JSQWebViewControllerMod42.framework", "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", @@ -561,7 +561,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewControllerMod42.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", @@ -583,7 +583,7 @@ "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", - "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewControllerMod42/JSQWebViewControllerMod42.framework", "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", @@ -595,7 +595,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewControllerMod42.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", @@ -617,7 +617,7 @@ "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", - "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewControllerMod42/JSQWebViewControllerMod42.framework", "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", @@ -629,7 +629,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewControllerMod42.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", @@ -651,7 +651,7 @@ "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", - "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewControllerMod42/JSQWebViewControllerMod42.framework", "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", @@ -665,7 +665,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewControllerMod42.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", diff --git a/Example/Podfile.lock b/Example/Podfile.lock index a0fdd0b9d..04efe9f47 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -3,13 +3,13 @@ PODS: - FolioReaderKit (1.3.0): - AEXML (= 4.3.3) - FontBlaster (= 4.1.0) - - JSQWebViewController (= 6.0.0) + - JSQWebViewControllerMod42 (= 6.1.1) - MenuItemKit (= 3.1.3) - RealmSwift (= 3.13.1) - SSZipArchive (= 2.1.1) - ZFDragableModalTransition (= 0.6) - FontBlaster (4.1.0) - - JSQWebViewController (6.0.0) + - JSQWebViewControllerMod42 (6.1.1) - MenuItemKit (3.1.3) - Nimble (7.3.1) - Quick (1.3.2) @@ -30,7 +30,7 @@ SPEC REPOS: https://github.com/cocoapods/specs.git: - AEXML - FontBlaster - - JSQWebViewController + - JSQWebViewControllerMod42 - MenuItemKit - Nimble - Quick @@ -45,9 +45,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AEXML: 601f41fcaa7bda7605cad153b0f43db9ec006c0f - FolioReaderKit: 34276186e904dc148a6353e367d0afa46a7fbdfb + FolioReaderKit: a3e2e27e4daea783a4ff5ee655d1390260b4429f FontBlaster: 127aa66419478d1c62926c7fdb39841633344a45 - JSQWebViewController: 51041569b75d19dbb6b7fe0b7ae053c32409a9be + JSQWebViewControllerMod42: f693c6c3606ea26ddc4e88879f794b049bd9de87 MenuItemKit: 0f850e630b0a3d2bd80fec54db87ce0d2077ada2 Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae Quick: 2623cb30d7a7f41ca62f684f679586558f483d46 diff --git a/FolioReaderKit.podspec b/FolioReaderKit.podspec index 7c6205f39..9dee82eb1 100755 --- a/FolioReaderKit.podspec +++ b/FolioReaderKit.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.dependency 'ZFDragableModalTransition', '0.6' s.dependency 'AEXML', '4.3.3' s.dependency 'FontBlaster', '4.1.0' - s.dependency 'JSQWebViewController', '6.0.0' + s.dependency 'JSQWebViewControllerMod42', '6.1.1' s.dependency 'RealmSwift', '3.13.1' end diff --git a/Package.swift b/Package.swift index 465355052..8925f57b1 100644 --- a/Package.swift +++ b/Package.swift @@ -8,7 +8,7 @@ let package = Package( .Package(url: "https://github.com/zoonooz/ZFDragableModalTransition.git", majorVersion: 0, minor: 6), .Package(url: "https://github.com/tadija/AEXML.git", majorVersion: 4, minor: 2), .Package(url: "https://github.com/ArtSabintsev/FontBlaster.git", majorVersion: 4, minor: 0), - .Package(url: "https://github.com/fantim/JSQWebViewController.git", majorVersion: 6, minor: 0), + .Package(url: "https://github.com/fantim/JSQWebViewController.git", majorVersion: 6, minor: 1), .Package(url: "https://github.com/realm/realm-cocoa.git", majorVersion: 3, minor: 1), ] ) diff --git a/Source/FolioReaderPage.swift b/Source/FolioReaderPage.swift index 34cc111f6..8a220df9e 100755 --- a/Source/FolioReaderPage.swift +++ b/Source/FolioReaderPage.swift @@ -9,7 +9,7 @@ import UIKit import SafariServices import MenuItemKit -import JSQWebViewController +import JSQWebViewControllerMod42 /// Protocol which is used from `FolioReaderPage`s. @objc public protocol FolioReaderPageDelegate: class { From 50f1938031e737b24b8a742f8eaf0a4ca46b2afb Mon Sep 17 00:00:00 2001 From: fantim Date: Thu, 24 Jan 2019 13:15:32 -0800 Subject: [PATCH 14/14] build now under examples --- Example/MultipleInstances-Example/AppDelegate.swift | 2 +- Example/Storyboard-Example/AppDelegate.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/MultipleInstances-Example/AppDelegate.swift b/Example/MultipleInstances-Example/AppDelegate.swift index 64dc928ac..da3317d61 100644 --- a/Example/MultipleInstances-Example/AppDelegate.swift +++ b/Example/MultipleInstances-Example/AppDelegate.swift @@ -13,7 +13,7 @@ import FolioReaderKit class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } } diff --git a/Example/Storyboard-Example/AppDelegate.swift b/Example/Storyboard-Example/AppDelegate.swift index 7cf86fbeb..885466177 100644 --- a/Example/Storyboard-Example/AppDelegate.swift +++ b/Example/Storyboard-Example/AppDelegate.swift @@ -13,7 +13,7 @@ import FolioReaderKit class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } }