Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 4.0 upgrade #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
315 changes: 166 additions & 149 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 20 additions & 6 deletions Example/UXMPDFKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
614D2EE31C8C8A9A00A856CD /* sample.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 614D2EE21C8C8A9A00A856CD /* sample.pdf */; };
616B61061CF7395100B743A7 /* sample2.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 616B61051CF7395100B743A7 /* sample2.pdf */; };
619D94B91EE7B5FA0009538F /* CHANGELOG.md in Sources */ = {isa = PBXBuildFile; fileRef = 619D94B81EE7B5FA0009538F /* CHANGELOG.md */; };
61CBF9411D86EB7F00282554 /* sample3.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 61CBF9401D86EB7F00282554 /* sample3.pdf */; };
61D3B3771CDE9C1600E7C3A6 /* ExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61D3B3761CDE9C1600E7C3A6 /* ExampleViewController.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -160,13 +159,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = 9592M4L4J8;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -260,7 +259,6 @@
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
61D3B3771CDE9C1600E7C3A6 /* ExampleViewController.swift in Sources */,
619D94B91EE7B5FA0009538F /* CHANGELOG.md in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -294,14 +292,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -330,6 +334,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand All @@ -342,14 +347,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = 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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -370,6 +381,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0;
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -399,7 +411,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.uxmstudio.uxmpdfit;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -428,7 +441,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.uxmstudio.uxmpdfit;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -59,6 +60,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
24 changes: 10 additions & 14 deletions Example/UXMPDFKit/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="uvK-v8-bCe">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="uvK-v8-bCe">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -18,11 +14,11 @@
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="RQY-pS-dQA" customClass="PDFSinglePageViewer" customModule="UXMPDFKit">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="RQY-pS-dQA" customClass="UXMSinglePageViewer" customModule="UXMPDFKit">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="zJH-Zp-75z">
<size key="itemSize" width="50" height="50"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
Expand Down Expand Up @@ -57,27 +53,27 @@
<viewControllerLayoutGuide type="bottom" id="nef-rF-CcU"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="2p7-Jv-JUY">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="25" translatesAutoresizingMaskIntoConstraints="NO" id="OLW-lB-Po9">
<rect key="frame" x="20" y="72" width="335" height="200"/>
<rect key="frame" x="20" y="72" width="560" height="200"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="43y-sh-Ug0">
<rect key="frame" x="0.0" y="0.0" width="335" height="90"/>
<rect key="frame" x="0.0" y="0.0" width="560" height="90"/>
<constraints>
<constraint firstAttribute="height" constant="90" id="7C5-gA-uJ4"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yJY-V6-3bH">
<rect key="frame" x="0.0" y="115" width="335" height="30"/>
<rect key="frame" x="0.0" y="115" width="560" height="30"/>
<state key="normal" title="Show Storyboard PDF"/>
<connections>
<segue destination="vXZ-lx-hvc" kind="presentation" id="UN2-UW-JIQ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0IF-mC-Uht">
<rect key="frame" x="0.0" y="170" width="335" height="30"/>
<rect key="frame" x="0.0" y="170" width="560" height="30"/>
<state key="normal" title="Show Full PDF Viewer"/>
<connections>
<action selector="loadPDF" destination="YMO-8V-zsq" eventType="touchUpInside" id="tHc-eD-Jc7"/>
Expand Down
6 changes: 3 additions & 3 deletions Example/UXMPDFKit/ExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class ExampleViewController: UIViewController {
@IBAction func loadPDF() {

let url = Bundle.main.path(forResource: "sample2", ofType: "pdf")!
let document = try! PDFDocument.from(filePath: url)
let document = try! UXMPDFDocument.from(filePath: url)

let pdf = PDFViewController(document: document!)
let pdf = UXMPDFViewController(document: document!)
pdf.annotationController.annotationTypes = [
PDFHighlighterAnnotation.self,
PDFPenAnnotation.self,
PDFTextAnnotation.self
UXMTextAnnotation.self
]

self.navigationController?.pushViewController(pdf, animated: true)
Expand Down
4 changes: 2 additions & 2 deletions Example/UXMPDFKit/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import UXMPDFKit

class ViewController: UIViewController {

@IBOutlet var collectionView:PDFSinglePageViewer!
@IBOutlet var collectionView:UXMSinglePageViewer!

override func viewDidLoad() {
super.viewDidLoad()

let url = Bundle.main.path(forResource: "sample", ofType: "pdf")!
let document = try! PDFDocument(filePath: url, password: "")
let document = try! UXMPDFDocument(filePath: url, password: "")

self.collectionView.document = document
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// PDFAnnotation.swift
// UXMAnnotation.swift
// Pods
//
// Created by Chris Anderson on 3/7/16.
Expand All @@ -8,7 +8,7 @@

import UIKit

public protocol PDFAnnotation {
public protocol UXMAnnotation {

/// The page number the annotation is located on
var page: Int? { get set }
Expand Down Expand Up @@ -41,7 +41,7 @@ public protocol PDFAnnotation {
func encode(with aCoder: NSCoder)
}

public protocol PDFAnnotationButtonable: PDFAnnotation {
public protocol PDFAnnotationButtonable: UXMAnnotation {

/// Name for UIBarButtonItem representation of annotation
static var name: String? { get }
Expand All @@ -51,11 +51,11 @@ public protocol PDFAnnotationButtonable: PDFAnnotation {
}

public protocol PDFAnnotationEvent {
func annotationUpdated(annotation: PDFAnnotation)
func annotation(annotation: PDFAnnotation, selected action: String)
func annotationUpdated(annotation: UXMAnnotation)
func annotation(annotation: UXMAnnotation, selected action: String)
}

public protocol PDFAnnotationView {
var parent: PDFAnnotation? { get }
var parent: UXMAnnotation? { get }
var canBecomeFirstResponder: Bool { get }
}
Loading