diff --git a/.gitignore b/.gitignore index 7b134ba..f9992e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ DocX.xcodeproj/xcuserdata/mbertz.xcuserdatad .swiftpm/xcode/xcuserdata DocX-Examples/DocX-Examples.xcodeproj/xcuserdata +.swiftpm/xcode/package.xcworkspace/xcuserdata +DocX-Examples.xcworkspace/xcuserdata +DocX.xcodeproj/project.xcworkspace/xcuserdata +DocX.xcodeproj/xcuserdata diff --git a/DocX-Examples.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DocX-Examples.xcworkspace/xcshareddata/swiftpm/Package.resolved index d318bc7..a404b9a 100644 --- a/DocX-Examples.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DocX-Examples.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -6,7 +6,7 @@ "repositoryURL": "https://github.com/shinjukunian/AEXML.git", "state": { "branch": "master", - "revision": "58d395eaebc1fc43c8831fd23d887dc1a53f2d61", + "revision": "5ce38c72cb10c013145a72137ed8e98ca7e7127f", "version": null } }, diff --git a/DocX-Examples.xcworkspace/xcuserdata/morten.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/DocX-Examples.xcworkspace/xcuserdata/morten.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index cbeda1f..faeb69f 100644 --- a/DocX-Examples.xcworkspace/xcuserdata/morten.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/DocX-Examples.xcworkspace/xcuserdata/morten.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -17,8 +17,8 @@ endingColumnNumber = "9223372036854775807" startingLineNumber = "24" endingLineNumber = "24" - landmarkName = "unknown" - landmarkType = "0"> + landmarkName = "validateMenuItem(_:)" + landmarkType = "7"> + landmarkName = "saveDocument(_:)" + landmarkType = "7"> + + + + + + + + diff --git a/DocX-Examples/DocX-Examples-iOS/TextViewViewController.swift b/DocX-Examples/DocX-Examples-iOS/TextViewViewController.swift index 91d769f..1cdb7dc 100644 --- a/DocX-Examples/DocX-Examples-iOS/TextViewViewController.swift +++ b/DocX-Examples/DocX-Examples-iOS/TextViewViewController.swift @@ -11,7 +11,7 @@ import DocX import QuickLook -protocol DocXPreviewing:class,QLPreviewControllerDelegate,QLPreviewControllerDataSource{ +protocol DocXPreviewing:QLPreviewControllerDelegate,QLPreviewControllerDataSource{ var documentURL:URL? {get set} var attributedText:NSAttributedString? {get} } diff --git a/DocX-Examples/DocX-Examples.xcodeproj/project.pbxproj b/DocX-Examples/DocX-Examples.xcodeproj/project.pbxproj index ae6a779..b824299 100644 --- a/DocX-Examples/DocX-Examples.xcodeproj/project.pbxproj +++ b/DocX-Examples/DocX-Examples.xcodeproj/project.pbxproj @@ -198,7 +198,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1020; - LastUpgradeCheck = 1100; + LastUpgradeCheck = 1240; ORGANIZATIONNAME = "telethon k.k."; TargetAttributes = { 5AE8343A2237AF2600E68343 = { @@ -334,6 +334,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -395,6 +396,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -471,7 +473,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = DVQ96RL2KL; INFOPLIST_FILE = "DocX-Examples-iOS/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -492,7 +494,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = DVQ96RL2KL; INFOPLIST_FILE = "DocX-Examples-iOS/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/DocX-Examples/DocX-Examples.xcodeproj/xcshareddata/xcschemes/DocX-Examples-iOS.xcscheme b/DocX-Examples/DocX-Examples.xcodeproj/xcshareddata/xcschemes/DocX-Examples-iOS.xcscheme index deededb..e6453f3 100644 --- a/DocX-Examples/DocX-Examples.xcodeproj/xcshareddata/xcschemes/DocX-Examples-iOS.xcscheme +++ b/DocX-Examples/DocX-Examples.xcodeproj/xcshareddata/xcschemes/DocX-Examples-iOS.xcscheme @@ -1,6 +1,6 @@ @@ -32,9 +32,9 @@ timestampString = "574223050.881536" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "71" - endingLineNumber = "71" - landmarkName = "testWriteDocX(attributedString:)" + startingLineNumber = "70" + endingLineNumber = "70" + landmarkName = "testWriteDocX(attributedString:useBuiltin:)" landmarkType = "7"> @@ -66,10 +66,10 @@ timestampString = "574223050.881864" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "32" - endingLineNumber = "32" - landmarkName = "tearDown()" - landmarkType = "7"> + startingLineNumber = "31" + endingLineNumber = "31" + landmarkName = "DocXTests" + landmarkType = "3"> @@ -304,8 +304,8 @@ timestampString = "574223050.882542" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "194" - endingLineNumber = "194" + startingLineNumber = "193" + endingLineNumber = "193" landmarkName = "testLink()" landmarkType = "7"> @@ -354,8 +354,8 @@ filePath = "DocXTests/DocXTests.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "181" - endingLineNumber = "181" + startingLineNumber = "180" + endingLineNumber = "180" landmarkName = "test山田電気FuriganaAttributed_ParagraphStyle_strikethrough()" landmarkType = "7"> @@ -370,8 +370,8 @@ filePath = "DocXTests/DocXTests.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "192" - endingLineNumber = "192" + startingLineNumber = "191" + endingLineNumber = "191" landmarkName = "testLink()" landmarkType = "7"> diff --git a/DocX/NSAttributedString+DocX-macOS.swift b/DocX/NSAttributedString+DocX-macOS.swift index a6c7030..5433980 100644 --- a/DocX/NSAttributedString+DocX-macOS.swift +++ b/DocX/NSAttributedString+DocX-macOS.swift @@ -15,11 +15,11 @@ import AEXML // this version is based on in initially using the TextKit docx Writer. Since it doesnt support furigana or links, we might go entirely with our own implementatuion extension NSAttributedString:DocX{ + @objc public func writeDocX(to url: URL) throws { try self.writeDocX(to: url, useBuiltIn: true) } - @objc public func writeDocX(to url: URL, useBuiltIn:Bool = true) throws{ let tempURL=try FileManager.default.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: url, create: true) diff --git a/DocX/NSAttributedString+DocX.swift b/DocX/NSAttributedString+DocX.swift index a658385..8bc27b3 100644 --- a/DocX/NSAttributedString+DocX.swift +++ b/DocX/NSAttributedString+DocX.swift @@ -23,7 +23,7 @@ extension NSAttributedString:DocX{ } let docURL=tempURL.appendingPathComponent(UUID().uuidString, isDirectory: true) - guard let blankURL=Bundle.module.url(forResource: "blank", withExtension: nil) else{throw DocXSavingErrors.noBlankDocument} + guard let blankURL=Bundle.blankDocumentURL else{throw DocXSavingErrors.noBlankDocument} try FileManager.default.copyItem(at: blankURL, to: docURL) let docPath=docURL.appendingPathComponent("word").appendingPathComponent("document").appendingPathExtension("xml") @@ -51,4 +51,19 @@ extension NSAttributedString:DocX{ } + +#if SWIFT_PACKAGE +extension Bundle{ + class var blankDocumentURL:URL?{ + return Bundle.module.url(forResource: "blank", withExtension: nil) + } +} +#else +extension Bundle{ + class var blankDocumentURL:URL?{ + return Bundle(for: DocumentRoot.self).url(forResource: "blank", withExtension: nil) + } +} +#endif + #endif diff --git a/DocXTests/DocXTests.swift b/DocXTests/DocXTests.swift index 7af030b..6a027f2 100644 --- a/DocXTests/DocXTests.swift +++ b/DocXTests/DocXTests.swift @@ -7,13 +7,12 @@ // import XCTest + @testable import DocX #if os(macOS) -@available(iOS 10.0, *) class DocXTests: XCTestCase { - var tempURL:URL=URL(fileURLWithPath: "") diff --git a/Package.resolved b/Package.resolved index d318bc7..a404b9a 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,7 +6,7 @@ "repositoryURL": "https://github.com/shinjukunian/AEXML.git", "state": { "branch": "master", - "revision": "58d395eaebc1fc43c8831fd23d887dc1a53f2d61", + "revision": "5ce38c72cb10c013145a72137ed8e98ca7e7127f", "version": null } },