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

Feature/#98 add spm support #101

Merged
merged 7 commits into from
Feb 5, 2020
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 @@ -34,3 +34,5 @@ Carthage
# `pod install` in .travis.yml
#
# Pods/
.swiftpm
SMillerDev marked this conversation as resolved.
Show resolved Hide resolved
.build
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ os: osx
language: swift
xcode_project: MarkyMark.xcodeproj
xcode_scheme: markymark_Tests
osx_image: xcode10
osx_image: xcode11.3
podfile: Example/Podfile
before_install:
- gem install cocoapods # Since Travis is not always on latest version
- pod repo update
- pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -workspace Example/markymark.xcworkspace -scheme markymark-Example -destination 'platform=iOS Simulator,name=iPhone 8' | xcpretty
- swift package generate-xcodeproj
- xcodebuild build -sdk iphoneos -scheme 'Marky-Mark-Package' -project Marky-Mark.xcodeproj
# - pod lib lint
after_success:
- bash <(curl -s https://codecov.io/bash)
2 changes: 0 additions & 2 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

target 'markymark_Example' do
pod 'markymark', :path => '../'
pod 'SwiftLint'
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DEPENDENCIES:
- SwiftLint

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- SwiftLint

EXTERNAL SOURCES:
Expand All @@ -18,6 +18,6 @@ SPEC CHECKSUMS:
markymark: e7fa1cdb7ad51c21a46cda308ad8ef4511fa49f6
SwiftLint: 7f5f7de0da74a649b16616cb5246ae323489656e

PODFILE CHECKSUM: ac26bbd0b2acca180dc458845f0951e758f55812
PODFILE CHECKSUM: e6179d5e64bda0057471cea1521ff93bf207a88b

COCOAPODS: 1.7.2
COCOAPODS: 1.8.4
9 changes: 9 additions & 0 deletions Example/markymark/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
if #available(iOS 10.0, *) {
app.open(url, options: [:], completionHandler: nil)
} else {
app.openURL(url)
}
return true
}
}
23 changes: 23 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version:5.0

import PackageDescription

let package = Package(
name: "Marky-Mark",
platforms: [
.iOS("8.0"),
],
products: [
.library(
name: "markymark",
targets: ["markymark"]),
],
dependencies: [],
targets: [
.target(
name: "markymark",
dependencies: [],
path: "markymark"),
],
swiftLanguageVersions: [.v5]
)
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ markDownTextView.onDidConvertMarkDownItemToView = {
}
```

### Changing link behavior

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.
### Link behavior
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.

```swift
let markDownView = MarkDownTextView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import UIKit

@IBDesignable
open class MarkdownAttributedLabel: AttributedInteractiveLabel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import UIKit

public enum MarkDownConfiguration {
case view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import UIKit

public class DefaultURLOpener: URLOpener {

Expand All @@ -21,6 +22,12 @@ public class DefaultURLOpener: URLOpener {
}

public func open(url: URL) {
_ = sharedApplication?.openURL(url)
guard let sharedApplication = sharedApplication else { return }

if #available(iOS 10, *) {
_ = sharedApplication.delegate?.application?(sharedApplication, open: url, options: [:])
} else {
_ = sharedApplication.delegate?.application?(sharedApplication, handleOpen: url)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

class HeaderAttributedStringLayoutBlockBuilder: InlineAttributedStringLayoutBlockBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

class ParagraphAttributedStringLayoutBlockBuilder: InlineAttributedStringLayoutBlockBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

class QuoteAttributedStringLayoutBlockBuilder: InlineAttributedStringLayoutBlockBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import UIKit

class InlineAttributedStringLayoutBlockBuilder: LayoutBlockBuilder<NSMutableAttributedString> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import UIKit

public protocol LetterSpacingStylingRule: ItemStyling {
var letterSpacing: CGFloat? { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//

import Foundation
import UIKit

public protocol MinimumHeightStylingRule: ItemStyling {

Expand Down