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 Package Manager support #81

Merged
merged 27 commits into from
Feb 25, 2021
Merged
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/
.swiftpm/
Package.resolved

# CocoaPods
#
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# * http://www.objc.io/issue-6/travis-ci.html
# * https://github.com/supermarin/xcpretty#usage

osx_image: xcode7.3
osx_image: xcode12
language: objective-c
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -workspace Example/MarkdownKit.xcworkspace -scheme MarkdownKit-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
- swift build
22 changes: 12 additions & 10 deletions MarkdownKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

/* Begin PBXBuildFile section */
354E1AE7F8A6582615E761F5 /* Pods_Example_AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 44808A771005F320A076CA59 /* Pods_Example_AppKit.framework */; };
3D6C279C25E80DD8008ED858 /* Typealias.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D6C279B25E80DD8008ED858 /* Typealias.swift */; };
3D6C279D25E80DD8008ED858 /* Typealias.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D6C279B25E80DD8008ED858 /* Typealias.swift */; };
3D6C27A225E80DE5008ED858 /* MarkdownStrikethrough.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB3627C23154D90005D48C8 /* MarkdownStrikethrough.swift */; };
3EB3627D23154D90005D48C8 /* MarkdownStrikethrough.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB3627C23154D90005D48C8 /* MarkdownStrikethrough.swift */; };
9E5A24F1B38B986D07AD63D1 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F52B0A5C8C127FBD3FEEC91A /* Pods_Example.framework */; };
B62C1BEB21EF7D8D00308C8C /* String+HTMLDecode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B62C1BE221EF7D8C00308C8C /* String+HTMLDecode.swift */; };
Expand Down Expand Up @@ -41,8 +44,6 @@
B64AF62B220340AE0048439D /* MarkdownLinkElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = B672001721EF8A96008649E1 /* MarkdownLinkElement.swift */; };
B64AF62C220340BC0048439D /* MarkdownLevelElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = B672001821EF8A96008649E1 /* MarkdownLevelElement.swift */; };
B64AF62D220340BF0048439D /* MarkdownElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = B672001921EF8A96008649E1 /* MarkdownElement.swift */; };
B64AF62F220340D90048439D /* Typealias.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64AF62E220340D90048439D /* Typealias.swift */; };
B64AF6322203412B0048439D /* Typealias.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64AF6302203412B0048439D /* Typealias.swift */; };
B64AF633220341960048439D /* MarkdownStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B672001A21EF8A96008649E1 /* MarkdownStyle.swift */; };
B64AF636220343880048439D /* MarkdownHeader+AppKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64AF635220343780048439D /* MarkdownHeader+AppKit.swift */; };
B64AF639220343E00048439D /* MarkdownLink+AppKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64AF637220343D30048439D /* MarkdownLink+AppKit.swift */; };
Expand Down Expand Up @@ -81,6 +82,7 @@
330677E6D2FE9F16CAD4F8D7 /* Pods-Example-AppKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-AppKit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example-AppKit/Pods-Example-AppKit.debug.xcconfig"; sourceTree = "<group>"; };
34810B607C4D22C8D6BAAA18 /* Pods-Example-AppKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-AppKit.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example-AppKit/Pods-Example-AppKit.release.xcconfig"; sourceTree = "<group>"; };
38B62CADC4622978652DE843 /* Pods-Example-AppKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-AppKit.debug.xcconfig"; path = "Target Support Files/Pods-Example-AppKit/Pods-Example-AppKit.debug.xcconfig"; sourceTree = "<group>"; };
3D6C279B25E80DD8008ED858 /* Typealias.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Typealias.swift; sourceTree = "<group>"; };
3EB3627C23154D90005D48C8 /* MarkdownStrikethrough.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkdownStrikethrough.swift; sourceTree = "<group>"; };
44808A771005F320A076CA59 /* Pods_Example_AppKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_AppKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
53C5892615913D5AFC9420DD /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
Expand All @@ -106,8 +108,6 @@
B64AF6142203402F0048439D /* MarkdownKit_osx.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MarkdownKit_osx.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B64AF616220340300048439D /* MarkdownKit_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MarkdownKit_mac.h; sourceTree = "<group>"; };
B64AF617220340300048439D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B64AF62E220340D90048439D /* Typealias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Typealias.swift; sourceTree = "<group>"; };
B64AF6302203412B0048439D /* Typealias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Typealias.swift; sourceTree = "<group>"; };
B64AF635220343780048439D /* MarkdownHeader+AppKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MarkdownHeader+AppKit.swift"; sourceTree = "<group>"; };
B64AF637220343D30048439D /* MarkdownLink+AppKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MarkdownLink+AppKit.swift"; sourceTree = "<group>"; };
B64AF63A220343FC0048439D /* MarkdownCode+AppKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MarkdownCode+AppKit.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -341,7 +341,6 @@
children = (
B64AF66122034BEF0048439D /* Extensions */,
B64AF65A22034AED0048439D /* Elements */,
B64AF62E220340D90048439D /* Typealias.swift */,
B64AF63C220345E40048439D /* MarkdownParser+UIKit.swift */,
);
path = UIKit;
Expand All @@ -352,7 +351,6 @@
children = (
B64AF66222034BFE0048439D /* Extensions */,
B64AF65922034AE60048439D /* Elements */,
B64AF6302203412B0048439D /* Typealias.swift */,
B64AF63F220345E80048439D /* MarkdownParser+AppKit.swift */,
);
path = AppKit;
Expand All @@ -365,6 +363,7 @@
B672000721EF8A96008649E1 /* Elements */,
B672000421EF8A96008649E1 /* Extensions */,
B672000321EF8A96008649E1 /* MarkdownParser.swift */,
3D6C279B25E80DD8008ED858 /* Typealias.swift */,
);
path = Common;
sourceTree = "<group>";
Expand Down Expand Up @@ -860,12 +859,12 @@
B672002621EF8A96008649E1 /* MarkdownList.swift in Sources */,
B672002221EF8A96008649E1 /* MarkdownEscaping.swift in Sources */,
B672002C21EF8A96008649E1 /* MarkdownLevelElement.swift in Sources */,
3D6C279C25E80DD8008ED858 /* Typealias.swift in Sources */,
B64AF60B22031A670048439D /* MarkdownHeader+UIKit.swift in Sources */,
B672002A21EF8A96008649E1 /* MarkdownCommonElement.swift in Sources */,
B672002E21EF8A96008649E1 /* MarkdownStyle.swift in Sources */,
B672002921EF8A96008649E1 /* MarkdownItalic.swift in Sources */,
3EB3627D23154D90005D48C8 /* MarkdownStrikethrough.swift in Sources */,
B64AF62F220340D90048439D /* Typealias.swift in Sources */,
B672001C21EF8A96008649E1 /* String+UTF16.swift in Sources */,
B672002421EF8A96008649E1 /* MarkdownQuote.swift in Sources */,
B672002D21EF8A96008649E1 /* MarkdownElement.swift in Sources */,
Expand All @@ -880,7 +879,6 @@
files = (
B64AF66522034C240048439D /* MarkdownFont+Traits.swift in Sources */,
B64AF62B220340AE0048439D /* MarkdownLinkElement.swift in Sources */,
B64AF6322203412B0048439D /* Typealias.swift in Sources */,
B64AF625220340740048439D /* MarkdownItalic.swift in Sources */,
B64AF624220340660048439D /* MarkdownAutomaticLink.swift in Sources */,
B64AF639220343E00048439D /* MarkdownLink+AppKit.swift in Sources */,
Expand All @@ -897,10 +895,12 @@
B64AF62C220340BC0048439D /* MarkdownLevelElement.swift in Sources */,
B64AF6282203408F0048439D /* MarkdownUnescaping.swift in Sources */,
B64AF61E220340520048439D /* MarkdownQuote.swift in Sources */,
3D6C27A225E80DE5008ED858 /* MarkdownStrikethrough.swift in Sources */,
B64AF61D2203403A0048439D /* String+UTF16.swift in Sources */,
B64AF62D220340BF0048439D /* MarkdownElement.swift in Sources */,
B64AF623220340630048439D /* MarkdownLink.swift in Sources */,
B64AF636220343880048439D /* MarkdownHeader+AppKit.swift in Sources */,
3D6C279D25E80DD8008ED858 /* Typealias.swift in Sources */,
B64AF626220340790048439D /* MarkdownCode.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -996,7 +996,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1051,7 +1052,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
78 changes: 78 additions & 0 deletions MarkdownKit.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B62C1BAC21EF7C8000308C8C"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:MarkdownKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B62C1BAC21EF7C8000308C8C"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:MarkdownKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B62C1BAC21EF7C8000308C8C"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:MarkdownKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
// Created by Bruno Oliveira on 31/01/2019.
// Copyright © 2019 Ivan Bruel. All rights reserved.
//
#if canImport(AppKit)

import AppKit

public extension MarkdownCode {
static let defaultHighlightColor = MarkdownColor(red: 0.90, green: 0.20, blue: 0.40, alpha: 1.0)
static let defaultBackgroundColor = MarkdownColor(red: 0.85, green: 0.85, blue: 0.85, alpha: 1.0)
static let defaultFont = MarkdownFont(name: "Menlo-Regular", size: 16)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
// Created by Bruno Oliveira on 31/01/2019.
// Copyright © 2019 Ivan Bruel. All rights reserved.
//
#if canImport(AppKit)

import AppKit

public extension MarkdownHeader {
static let defaultFont = NSFont.boldSystemFont(ofSize: NSFont.systemFontSize)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
// Created by Bruno Oliveira on 31/01/2019.
// Copyright © 2019 Ivan Bruel. All rights reserved.
//
#if canImport(AppKit)

import AppKit

public extension MarkdownLink {
static let defaultColor = NSColor.blue
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Bruno Oliveira on 31/01/2019.
// Copyright © 2019 Ivan Bruel. All rights reserved.
//
#if canImport(AppKit)

import AppKit

Expand All @@ -21,3 +22,5 @@ public extension MarkdownFont {
return NSFontManager().convert(self, toSize: size)
}
}

#endif
3 changes: 3 additions & 0 deletions MarkdownKit/Sources/AppKit/MarkdownParser+AppKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
// Created by Bruno Oliveira on 31/01/2019.
// Copyright © 2019 Ivan Bruel. All rights reserved.
//
#if canImport(AppKit)

import AppKit

public extension MarkdownParser {
static let defaultFont = NSFont.systemFont(ofSize: NSFont.smallSystemFontSize)
static let defaultColor = NSColor.black
}

#endif
13 changes: 0 additions & 13 deletions MarkdownKit/Sources/AppKit/Typealias.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//
import Foundation
import CoreGraphics

open class MarkdownHeader: MarkdownLevelElement {

Expand Down
29 changes: 29 additions & 0 deletions MarkdownKit/Sources/Common/Typealias.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Typealias+UIKit.swift
// MarkdownKit
//
// Created by Bruno Oliveira on 31/01/2019.
// Copyright © 2019 Ivan Bruel. All rights reserved.
//

#if canImport(AppKit)

import AppKit

public typealias MarkdownFont = NSFont
public typealias MarkdownColor = NSColor

public typealias NSMutableParagraphStyle = AppKit.NSMutableParagraphStyle
public typealias NSUnderlineStyle = AppKit.NSUnderlineStyle

#elseif canImport(UIKit)

import UIKit

public typealias MarkdownFont = UIFont
public typealias MarkdownColor = UIColor

public typealias NSMutableParagraphStyle = UIKit.NSMutableParagraphStyle
public typealias NSUnderlineStyle = UIKit.NSUnderlineStyle

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
// Copyright © 2019 Ivan Bruel. All rights reserved.
//

#if canImport(UIKit)

import UIKit

public extension MarkdownCode {
static let defaultHighlightColor = UIColor(red: 0.90, green: 0.20, blue: 0.40, alpha: 1.0)
static let defaultBackgroundColor = UIColor(red: 0.85, green: 0.85, blue: 0.85, alpha: 1.0)
static let defaultFont = UIFont(name: "Menlo-Regular", size: 16)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
// Copyright © 2019 Ivan Bruel. All rights reserved.
//

#if canImport(UIKit)

import UIKit

public extension MarkdownHeader {
static let defaultFont = UIFont.boldSystemFont(ofSize: UIFont.smallSystemFontSize)
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
// Copyright © 2019 Ivan Bruel. All rights reserved.
//

#if canImport(UIKit)

import UIKit

public extension MarkdownLink {
static let defaultColor = UIColor.blue
}

#endif
5 changes: 5 additions & 0 deletions MarkdownKit/Sources/UIKit/Extensions/UIFont+Traits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// Created by Ivan Bruel on 19/07/16.
//
//

#if canImport(UIKit)

import UIKit

extension UIFont {
Expand All @@ -24,3 +27,5 @@ extension UIFont {
return withTraits(.traitItalic)
}
}

#endif
Loading