Skip to content

Commit 9318f7b

Browse files
author
lvnkmn
authored
Merge pull request #101 from lvnkmn/feature/#98-Add-spm-support
Feature/#98 add spm support
2 parents 5f843b0 + 3e2316f commit 9318f7b

16 files changed

+58
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ Carthage
3434
# `pod install` in .travis.yml
3535
#
3636
# Pods/
37+
.swiftpm
38+
.build

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ os: osx
33
language: swift
44
xcode_project: MarkyMark.xcodeproj
55
xcode_scheme: markymark_Tests
6-
osx_image: xcode10
6+
osx_image: xcode11.3
77
podfile: Example/Podfile
88
before_install:
99
- gem install cocoapods # Since Travis is not always on latest version
10-
- pod repo update
1110
- pod install --project-directory=Example
1211
script:
1312
- set -o pipefail && xcodebuild test -workspace Example/markymark.xcworkspace -scheme markymark-Example -destination 'platform=iOS Simulator,name=iPhone 8' | xcpretty
13+
- swift package generate-xcodeproj
14+
- xcodebuild build -sdk iphoneos -scheme 'Marky-Mark-Package' -project Marky-Mark.xcodeproj
1415
# - pod lib lint
1516
after_success:
1617
- bash <(curl -s https://codecov.io/bash)

Example/Podfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use_frameworks!
22

3-
source 'https://github.com/CocoaPods/Specs.git'
4-
53
target 'markymark_Example' do
64
pod 'markymark', :path => '../'
75
pod 'SwiftLint'

Example/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DEPENDENCIES:
77
- SwiftLint
88

99
SPEC REPOS:
10-
https://github.com/cocoapods/specs.git:
10+
https://github.com/CocoaPods/Specs.git:
1111
- SwiftLint
1212

1313
EXTERNAL SOURCES:
@@ -18,6 +18,6 @@ SPEC CHECKSUMS:
1818
markymark: e7fa1cdb7ad51c21a46cda308ad8ef4511fa49f6
1919
SwiftLint: 7f5f7de0da74a649b16616cb5246ae323489656e
2020

21-
PODFILE CHECKSUM: ac26bbd0b2acca180dc458845f0951e758f55812
21+
PODFILE CHECKSUM: e6179d5e64bda0057471cea1521ff93bf207a88b
2222

23-
COCOAPODS: 1.7.2
23+
COCOAPODS: 1.8.4

Example/markymark/AppDelegate.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1717
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1818
return true
1919
}
20+
21+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
22+
if #available(iOS 10.0, *) {
23+
app.open(url, options: [:], completionHandler: nil)
24+
} else {
25+
app.openURL(url)
26+
}
27+
return true
28+
}
2029
}

Package.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// swift-tools-version:5.0
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "Marky-Mark",
7+
platforms: [
8+
.iOS("8.0"),
9+
],
10+
products: [
11+
.library(
12+
name: "markymark",
13+
targets: ["markymark"]),
14+
],
15+
dependencies: [],
16+
targets: [
17+
.target(
18+
name: "markymark",
19+
dependencies: [],
20+
path: "markymark"),
21+
],
22+
swiftLanguageVersions: [.v5]
23+
)

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,8 @@ markDownTextView.onDidConvertMarkDownItemToView = {
287287
}
288288
```
289289

290-
### Changing link behavior
291-
292-
By default Markymark opens URL's using `UIApplication.shared.open(url:)`. Markymark allows changing this behavior by passing a custom URLOpener, an object that comforms to the `URLOpener` protocol.
290+
### Link behavior
291+
By default Markymark opens URL's using `UIApplication.shared.delegate.open(_:open:options)`. links will only be openened when this method is implemented. Markymark allows changing this behavior by passing a custom URLOpener, an object that conforms to the `URLOpener` protocol.
293292

294293
```swift
295294
let markDownView = MarkDownTextView()

markymark/Classes/Default implementations/Attributed label/MarkdownAttributedLabel.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import UIKit
910

1011
@IBDesignable
1112
open class MarkdownAttributedLabel: AttributedInteractiveLabel {

markymark/Classes/Default implementations/MarkDownTextView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import UIKit
910

1011
public enum MarkDownConfiguration {
1112
case view

markymark/Classes/Default implementations/URL Openers/DefaultURLOpener.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import UIKit
910

1011
public class DefaultURLOpener: URLOpener {
1112

@@ -21,6 +22,12 @@ public class DefaultURLOpener: URLOpener {
2122
}
2223

2324
public func open(url: URL) {
24-
_ = sharedApplication?.openURL(url)
25+
guard let sharedApplication = sharedApplication else { return }
26+
27+
if #available(iOS 10, *) {
28+
_ = sharedApplication.delegate?.application?(sharedApplication, open: url, options: [:])
29+
} else {
30+
_ = sharedApplication.delegate?.application?(sharedApplication, handleOpen: url)
31+
}
2532
}
2633
}

markymark/Classes/Layout Builders/AttributedString/Block Builders/Block/HeaderAttributedStringLayoutBlockBuilder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Foundation
10+
import UIKit
1011

1112
class HeaderAttributedStringLayoutBlockBuilder: InlineAttributedStringLayoutBlockBuilder {
1213

markymark/Classes/Layout Builders/AttributedString/Block Builders/Block/ParagraphAttributedStringLayoutBlockBuilder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Foundation
10+
import UIKit
1011

1112
class ParagraphAttributedStringLayoutBlockBuilder: InlineAttributedStringLayoutBlockBuilder {
1213

markymark/Classes/Layout Builders/AttributedString/Block Builders/Block/QuoteAttributedStringLayoutBlockBuilder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Foundation
10+
import UIKit
1011

1112
class QuoteAttributedStringLayoutBlockBuilder: InlineAttributedStringLayoutBlockBuilder {
1213

markymark/Classes/Layout Builders/AttributedString/Block Builders/Inline/InlineAttributedStringLayoutBlockBuilder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Foundation
10+
import UIKit
1011

1112
class InlineAttributedStringLayoutBlockBuilder: LayoutBlockBuilder<NSMutableAttributedString> {
1213

markymark/Classes/Styling/Protocols/LetterSpacingStylingRule.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import UIKit
910

1011
public protocol LetterSpacingStylingRule: ItemStyling {
1112
var letterSpacing: CGFloat? { get }

markymark/Classes/Styling/Protocols/MinimumHeightStylingRule.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55

66
import Foundation
7+
import UIKit
78

89
public protocol MinimumHeightStylingRule: ItemStyling {
910

0 commit comments

Comments
 (0)