Skip to content

Commit

Permalink
Add proper support for Xcode 11 and SPM (#14)
Browse files Browse the repository at this point in the history
* Remove podspec

* Use Equatable synthesized conformance

* Remove Playgrounds

* Move source code

* Update package manifest

* Update README
  • Loading branch information
gonzalezreal authored Sep 11, 2019
1 parent 94d9735 commit 6cc9840
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 172 deletions.
24 changes: 0 additions & 24 deletions Markup.podspec

This file was deleted.

59 changes: 37 additions & 22 deletions Markup.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

/* Begin PBXBuildFile section */
52D6D9871BEFF229002C0205 /* Markup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52D6D97C1BEFF229002C0205 /* Markup.framework */; };
820C3D182328DB1200C3845B /* MarkupParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820C3D162328DB1200C3845B /* MarkupParserTests.swift */; };
820C3D192328DB1200C3845B /* MarkupParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820C3D162328DB1200C3845B /* MarkupParserTests.swift */; };
820C3D1A2328DB1200C3845B /* MarkupParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820C3D162328DB1200C3845B /* MarkupParserTests.swift */; };
820C3D1B2328DB1200C3845B /* MarkupRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820C3D172328DB1200C3845B /* MarkupRendererTests.swift */; };
820C3D1C2328DB1200C3845B /* MarkupRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820C3D172328DB1200C3845B /* MarkupRendererTests.swift */; };
820C3D1D2328DB1200C3845B /* MarkupRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820C3D172328DB1200C3845B /* MarkupRendererTests.swift */; };
99211A5E1F279AAE0039BB88 /* MarkupNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A591F279AAE0039BB88 /* MarkupNode.swift */; };
99211A5F1F279AAE0039BB88 /* MarkupNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A591F279AAE0039BB88 /* MarkupNode.swift */; };
99211A601F279AAE0039BB88 /* MarkupNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A591F279AAE0039BB88 /* MarkupNode.swift */; };
Expand All @@ -28,12 +34,6 @@
99211A6F1F279AAE0039BB88 /* MarkupTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A5D1F279AAE0039BB88 /* MarkupTokenizer.swift */; };
99211A701F279AAE0039BB88 /* MarkupTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A5D1F279AAE0039BB88 /* MarkupTokenizer.swift */; };
99211A711F279AAE0039BB88 /* MarkupTokenizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A5D1F279AAE0039BB88 /* MarkupTokenizer.swift */; };
99211A771F279C0A0039BB88 /* MarkupParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A721F279BCF0039BB88 /* MarkupParserTests.swift */; };
99211A781F279C0D0039BB88 /* MarkupParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A721F279BCF0039BB88 /* MarkupParserTests.swift */; };
99211A791F279C0E0039BB88 /* MarkupParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99211A721F279BCF0039BB88 /* MarkupParserTests.swift */; };
99E800001F28814500AAE464 /* MarkupRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99E8FFFF1F28814500AAE464 /* MarkupRendererTests.swift */; };
99E800011F28814500AAE464 /* MarkupRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99E8FFFF1F28814500AAE464 /* MarkupRendererTests.swift */; };
99E800021F28814500AAE464 /* MarkupRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99E8FFFF1F28814500AAE464 /* MarkupRendererTests.swift */; };
DD7502881C68FEDE006590AF /* Markup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52D6DA0F1BF000BD002C0205 /* Markup.framework */; };
DD7502921C690C7A006590AF /* Markup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52D6D9F01BEFFFBE002C0205 /* Markup.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -68,13 +68,13 @@
52D6D9E21BEFFF6E002C0205 /* Markup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Markup.framework; sourceTree = BUILT_PRODUCTS_DIR; };
52D6D9F01BEFFFBE002C0205 /* Markup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Markup.framework; sourceTree = BUILT_PRODUCTS_DIR; };
52D6DA0F1BF000BD002C0205 /* Markup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Markup.framework; sourceTree = BUILT_PRODUCTS_DIR; };
820C3D162328DB1200C3845B /* MarkupParserTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupParserTests.swift; sourceTree = "<group>"; };
820C3D172328DB1200C3845B /* MarkupRendererTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupRendererTests.swift; sourceTree = "<group>"; };
99211A591F279AAE0039BB88 /* MarkupNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupNode.swift; sourceTree = "<group>"; };
99211A5A1F279AAE0039BB88 /* MarkupParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupParser.swift; sourceTree = "<group>"; };
99211A5B1F279AAE0039BB88 /* MarkupRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupRenderer.swift; sourceTree = "<group>"; };
99211A5C1F279AAE0039BB88 /* MarkupToken.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupToken.swift; sourceTree = "<group>"; };
99211A5D1F279AAE0039BB88 /* MarkupTokenizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupTokenizer.swift; sourceTree = "<group>"; };
99211A721F279BCF0039BB88 /* MarkupParserTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupParserTests.swift; sourceTree = "<group>"; };
99E8FFFF1F28814500AAE464 /* MarkupRendererTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkupRendererTests.swift; sourceTree = "<group>"; };
AD2FAA261CD0B6D800659CF4 /* Markup.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Markup.plist; sourceTree = "<group>"; };
AD2FAA281CD0B6E100659CF4 /* MarkupTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MarkupTests.plist; sourceTree = "<group>"; };
DD75027A1C68FCFC006590AF /* Markup-macOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Markup-macOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -141,7 +141,7 @@
isa = PBXGroup;
children = (
8933C7811EB5B7E0000D00A4 /* Sources */,
8933C7831EB5B7EB000D00A4 /* Tests */,
820C3D142328DB1200C3845B /* Tests */,
52D6D99C1BEFF38C002C0205 /* Configs */,
52D6D97D1BEFF229002C0205 /* Products */,
);
Expand Down Expand Up @@ -170,7 +170,24 @@
path = Configs;
sourceTree = "<group>";
};
8933C7811EB5B7E0000D00A4 /* Sources */ = {
820C3D142328DB1200C3845B /* Tests */ = {
isa = PBXGroup;
children = (
820C3D152328DB1200C3845B /* MarkupTests */,
);
path = Tests;
sourceTree = "<group>";
};
820C3D152328DB1200C3845B /* MarkupTests */ = {
isa = PBXGroup;
children = (
820C3D162328DB1200C3845B /* MarkupParserTests.swift */,
820C3D172328DB1200C3845B /* MarkupRendererTests.swift */,
);
path = MarkupTests;
sourceTree = "<group>";
};
820C3D1E2328DB2500C3845B /* Markup */ = {
isa = PBXGroup;
children = (
99211A591F279AAE0039BB88 /* MarkupNode.swift */,
Expand All @@ -179,17 +196,15 @@
99211A5C1F279AAE0039BB88 /* MarkupToken.swift */,
99211A5D1F279AAE0039BB88 /* MarkupTokenizer.swift */,
);
path = Sources;
path = Markup;
sourceTree = "<group>";
};
8933C7831EB5B7EB000D00A4 /* Tests */ = {
8933C7811EB5B7E0000D00A4 /* Sources */ = {
isa = PBXGroup;
children = (
99211A721F279BCF0039BB88 /* MarkupParserTests.swift */,
99E8FFFF1F28814500AAE464 /* MarkupRendererTests.swift */,
820C3D1E2328DB2500C3845B /* Markup */,
);
name = Tests;
path = Tests/MarkupTests;
path = Sources;
sourceTree = "<group>";
};
DD7502721C68FC1B006590AF /* Frameworks */ = {
Expand Down Expand Up @@ -580,8 +595,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
99E800001F28814500AAE464 /* MarkupRendererTests.swift in Sources */,
99211A771F279C0A0039BB88 /* MarkupParserTests.swift in Sources */,
820C3D1B2328DB1200C3845B /* MarkupRendererTests.swift in Sources */,
820C3D182328DB1200C3845B /* MarkupParserTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -625,17 +640,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
99E800011F28814500AAE464 /* MarkupRendererTests.swift in Sources */,
99211A781F279C0D0039BB88 /* MarkupParserTests.swift in Sources */,
820C3D1C2328DB1200C3845B /* MarkupRendererTests.swift in Sources */,
820C3D192328DB1200C3845B /* MarkupParserTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DD7502891C690C7A006590AF /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
99E800021F28814500AAE464 /* MarkupRendererTests.swift in Sources */,
99211A791F279C0E0039BB88 /* MarkupParserTests.swift in Sources */,
820C3D1D2328DB1200C3845B /* MarkupRendererTests.swift in Sources */,
820C3D1A2328DB1200C3845B /* MarkupParserTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
13 changes: 0 additions & 13 deletions Markup.xcworkspace/contents.xcworkspacedata

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

17 changes: 16 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
// swift-tools-version:5.1

import PackageDescription

let package = Package(
name: "Markup"
name: "Markup",
platforms: [
.iOS(.v8),
.macOS(.v10_10),
.tvOS(.v9),
.watchOS(.v2)
],
products: [
.library(name: "Markup", targets: ["Markup"]),
],
targets: [
.target(name: "Markup", dependencies: []),
.testTarget(name: "MarkupTests", dependencies: ["Markup"]),
]
)
21 changes: 0 additions & 21 deletions Playgrounds/Parser.playground/Contents.swift

This file was deleted.

4 changes: 0 additions & 4 deletions Playgrounds/Parser.playground/contents.xcplayground

This file was deleted.

15 changes: 0 additions & 15 deletions Playgrounds/Renderer.playground/Contents.swift

This file was deleted.

4 changes: 0 additions & 4 deletions Playgrounds/Renderer.playground/contents.xcplayground

This file was deleted.

24 changes: 0 additions & 24 deletions Playgrounds/Tokenizer.playground/Contents.swift

This file was deleted.

4 changes: 0 additions & 4 deletions Playgrounds/Tokenizer.playground/contents.xcplayground

This file was deleted.

25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Markup
[![CocoaPods](https://img.shields.io/cocoapods/v/Markup.svg)](https://cocoapods.org/pods/Markup)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
![Swift 5.1](https://img.shields.io/badge/Swift-5.1-orange.svg)
[![Platforms](https://img.shields.io/cocoapods/p/Markup.svg)](https://cocoapods.org/pods/Markup)
[![Swift Package Manager](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods](https://img.shields.io/cocoapods/v/Markup.svg)](https://cocoapods.org/pods/Markup)
[![Twitter: @gonzalezreal](https://img.shields.io/badge/twitter-@gonzalezreal-blue.svg?style=flat)](https://twitter.com/gonzalezreal)

Markup generates attributed strings using a familiar markup syntax:

Expand Down Expand Up @@ -70,23 +73,21 @@ Both the parsing and the rendering will take linear time to complete.
[This post](https://medium.com/makingtuenti/writing-a-lightweight-markup-parser-in-swift-5c8a5f0f793f) explains how Markup internally works, in case you are curious about the implementation.

## Installation
**Using CocoaPods**
**Using the Swift Package Manager**

Add `pod Markup` to your `Podfile`
Add Markup as a dependency to your `Package.swift` file. For more information, see the [Swift Package Manager documentation](https://github.com/apple/swift-package-manager/tree/master/Documentation).

```
.package(url: "https://github.com/gonzalezreal/Markup", from: "2.3")
```

**Using Carthage**

Add `github "gonzalezreal/Markup"` to your `Cartfile`

**Using the Swift Package Manager**

Add `Package(url: "https://github.com/gonzalezreal/Markup.git", majorVersion: 1)` to your `Package.swift` file.

**Swift compatibility**
**Using CocoaPods**

- Version `2.2` supports `Swift 5.0`
- Version `2.1` supports `Swift 4.2`
- Version `2.0` supports `Swift 4`
Add `pod Markup` to your `Podfile`

## Help & Feedback
- [Open an issue](https://github.com/gonzalezreal/Markup/issues/new) if you need help, if you found a bug, or if you want to discuss a feature request.
Expand Down
2 changes: 2 additions & 0 deletions Sources/MarkupNode.swift → Sources/Markup/MarkupNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public enum MarkupNode {
case delete([MarkupNode])
}

extension MarkupNode: Equatable {}

extension MarkupNode {
init?(delimiter: UnicodeScalar, children: [MarkupNode]) {
switch delimiter {
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 1 addition & 14 deletions Sources/MarkupToken.swift → Sources/Markup/MarkupToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,7 @@ enum MarkupToken {
case rightDelimiter(UnicodeScalar)
}

extension MarkupToken: Equatable {
static func == (lhs: MarkupToken, rhs: MarkupToken) -> Bool {
switch (lhs, rhs) {
case let (.text(lvalue), .text(rvalue)):
return lvalue == rvalue
case let (.leftDelimiter(lvalue), .leftDelimiter(rvalue)):
return lvalue == rvalue
case let (.rightDelimiter(lvalue), .rightDelimiter(rvalue)):
return lvalue == rvalue
default:
return false
}
}
}
extension MarkupToken: Equatable {}

extension MarkupToken: CustomStringConvertible {
var description: String {
Expand Down
File renamed without changes.
14 changes: 0 additions & 14 deletions Tests/MarkupTests/MarkupParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@
import Markup
import XCTest

private func equalDump<T>(_ lhs: T, _ rhs: T) -> Bool {
var (ldump, rdump) = ("", "")
dump(lhs, to: &ldump)
dump(rhs, to: &rdump)

return ldump == rdump
}

extension MarkupNode: Equatable {
public static func == (lhs: MarkupNode, rhs: MarkupNode) -> Bool {
return equalDump(lhs, rhs)
}
}

class MarkupParserTests: XCTestCase {
func testPlainText_parse_returnsPlainText() {
// given
Expand Down

0 comments on commit 6cc9840

Please sign in to comment.