Skip to content

Commit 7166ac1

Browse files
committed
Migrate playground into a workspace and make use of Xcode 12's ability to depend on other frameworks. Display demo markdown text in a live view in Xcode.
1 parent 8f41b16 commit 7166ac1

File tree

7 files changed

+34
-11
lines changed

7 files changed

+34
-11
lines changed

MarkdownKit.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
CC72626E22F318C0001AB6D9 /* MarkdownKitProcess */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = MarkdownKitProcess; sourceTree = BUILT_PRODUCTS_DIR; };
100100
CC72627022F318C0001AB6D9 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
101101
CC72627522F318F3001AB6D9 /* AttributedStringGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedStringGenerator.swift; sourceTree = "<group>"; };
102-
CC72627922F31D59001AB6D9 /* MarkdownKitPlayground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = MarkdownKitPlayground.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
103102
CC7B603822AC67DC0092188C /* MarkdownInlineTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkdownInlineTests.swift; sourceTree = "<group>"; };
104103
CC7B603A22AC6AB40092188C /* DelimiterTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelimiterTransformer.swift; sourceTree = "<group>"; };
105104
CC7B603C22AC6AD70092188C /* CodeLinkHtmlTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeLinkHtmlTransformer.swift; sourceTree = "<group>"; };
@@ -177,7 +176,6 @@
177176
CC0DFBE222FDCCE0002ACD37 /* CONTRIBUTING.md */,
178177
CC6988C6227CDFB10021C7E1 /* LICENSE */,
179178
CC0DFBE022FDC617002ACD37 /* Package.swift */,
180-
CC72627922F31D59001AB6D9 /* MarkdownKitPlayground.playground */,
181179
CC2AF6EA227CD98100BEA420 /* MarkdownKit */,
182180
CC72626F22F318C0001AB6D9 /* MarkdownKitProcess */,
183181
CC2AF6F5227CD98100BEA420 /* MarkdownKitTests */,

MarkdownKitDemo.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

MarkdownKitPlayground.playground/Contents.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@
33
// MarkdownKit
44
//
55
// Created by Matthias Zenger on 01/08/2019.
6-
// Copyright © 2019 Google LLC.
6+
// Copyright © 2019-2020 Google LLC.
77
//
88
// Licensed under the Apache License, Version 2.0 (the "License");
99
// you may not use this file except in compliance with the License.
1010
// You may obtain a copy of the License at
1111
//
1212
// http://www.apache.org/licenses/LICENSE-2.0
1313
//
14-
// Unless required by applicable law or agreed to in writing, software
15-
// distributed under the License is distributed on an "AS IS" BASIS,
16-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17-
// See the License for the specific language governing permissions and
18-
// limitations under the License.
14+
// Unless required by applicable law or agreed to in writing,
15+
// software distributed under the License is distributed on an
16+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17+
// either express or implied. See the License for the specific
18+
// language governing permissions and limitations under the
19+
// License.
1920
//
2021

21-
markdownView(file: "Demo", width: 500, height: 810)
22+
import AppKit
23+
import PlaygroundSupport
24+
25+
PlaygroundPage.current.liveView =
26+
markdownView(file: "Demo", width: 500, height: 850)

MarkdownKitPlayground.playground/Resources/Demo.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ There is more text coming after the blockquote, including a table:
4646
| Albania | AL | +355 |
4747
| Argentina | AR | +54 |
4848
| Austria | AT | +43 |
49+
| Switzerland | CH | +41 |
4950

5051
Description lists also need special treatment when converted to `NSAttributedString`:
5152

@@ -54,3 +55,4 @@ One
5455

5556
Two
5657
: This is the description for _Two_
58+

MarkdownKitPlayground.playground/Sources/MarkdownPlayground.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import Foundation
2222
import PlaygroundSupport
23-
@testable import MarkdownKit
23+
import MarkdownKit
2424

2525
public class MarkdownView: NSView {
2626
let str: NSAttributedString
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<playground version='5.0' target-platform='macos'>
2+
<playground version='5.0' target-platform='macos' buildActiveScheme='true'>
33
<timeline fileName='timeline.xctimeline'/>
44
</playground>

0 commit comments

Comments
 (0)