Skip to content

Commit e945e33

Browse files
Merge pull request #12 from bow-swift/readme_2
Readme
2 parents eba58db + 017a3c9 commit e945e33

13 files changed

+79
-12
lines changed

README.md

+48-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@
1818
<a href="https://www.apple.com/macos/catalina/">
1919
<img src="https://img.shields.io/badge/macOS-10.15%2B-blue" alt="macOS 10.15+">
2020
</a>
21-
2221
</p>
2322

2423
&nbsp;
2524

2625
This project provides an extension for Xcode to integrate some nef features directly in the IDE. Using the core of `nef`, you can [export snippets](https://github.com/bow-swift/nef#-exporting-carbon-code-snippets) from your code selection directly in Xcode.
2726

27+
### Features
28+
29+
💡 Exports a [__code selection__](#-export-code-selection-to-image) to images for given Xcode Playgrounds.
30+
31+
💡 Generates [__Markdown__](#-generates-markdown-file-from-playground) files from Xcode Playground.
32+
33+
💡 Builds a [__Playground Book__](#-create-a-playground-book-from-your-swift-package) with external dependencies defined in a Swift Package.
34+
2835
&nbsp;
2936

3037
## 📥 Installation
@@ -37,16 +44,53 @@ To complete the installation, you should enable `nef` extension from `System Pre
3744
<img src="assets/nef-plugin-extensions.png" alt="nef: enable Xcode extension" width="90%"/>
3845
</p>
3946

40-
## 🌁 Export code selection to snippet
47+
## Usage
48+
### 🌁 Export code selection to image
4149

4250
In Xcode you can find the nef plugin options in `Editor`.
4351

44-
If you want to export your current code selection into a snippet, you only need to select the action `Editor > nef > Export code snippet`
52+
If you want to export your current code selection into a snippet, you only need to select the action `Editor > nef > Code selection → Image`
4553

4654
<p align="center">
4755
<img src="assets/nef-plugin-action-export.png" alt="nef: action for exporting code selection to snippet" width="90%"/>
48-
<img src="assets/nef-plugin-action-snippet.png" alt="nef: action for exporting code selection to snippet" width="50%"/>
4956
</p>
57+
<p align="center">
58+
<img src="assets/arrow-down.png" alt="nef: action for exporting code selection to snippet" width="8%"/>
59+
</p>
60+
<p align="center">
61+
<img src="assets/nef-plugin-action-snippet.png" alt="nef: action for exporting code selection to snippet" width="55%"/>
62+
</p>
63+
64+
#### 🔧 Preferences
65+
66+
You can customize the output image using the preferences action `Editor > nef > Preferences`
67+
68+
<p align="center">
69+
<img src="assets/nef-xcode-preferences.png" alt="nef: preferences Xcode extension" width="80%"/>
70+
</p>
71+
72+
&nbsp;
73+
74+
### 📃 Generates markdown file from Playground
75+
76+
Xcode Playgrounds let you write comments in markdown format using the symbols //: for single line comments, or /*: */ for multiline comments. Markup for playgrounds includes page level formatting for headings and other elements, formatting spans of characters, showing inline images, and several other features. You can read more in the [Markup Formatting Reference](https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/index.html).
77+
78+
You can create a markdown file from playground page with the nef action `Editor > nef > Playground → Markdown`
79+
80+
&nbsp;
81+
82+
### 📲 Create a Playground Book from your Swift package
83+
84+
You can create a Playground compatible with you iPad from a Swift package. You only need to open the swift package in Xcode,
85+
and select the action `Editor > nef > Swift Package → Playground Book`
86+
87+
It will ask you where to save the Playground Book, and it will start to build it.
88+
89+
<p align="center">
90+
<img src="assets/nef-plugin-playgroundbook.png" alt="nef: action for making a Playground Book" width="90%"/>
91+
</p>
92+
93+
> This feature needs to use SwiftPM tool. Consequently, it will need to disable the sandbox thus it is not allowed in the App Store; but if you want to enjoy this feature, you only need to install the `.dmg` you'll find in the [releases](https://github.com/bow-swift/nef-plugin/releases) section.
5094
5195
&nbsp;
5296

Support Files/en.lproj/Localizable.strings

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"copyright" = "Copyright © 2019 The nef authors";
1212
"github" = "Read more about nef on GitHub";
1313
"install_preferences" = "Open 'System Preferences'";
14-
"install_extensions" = "Select 'Extension'";
14+
"install_extensions" = "Select 'Extensions'";
1515
"nef_extension" = "Xcode Source Editor";
1616

1717
// MARK: - Preferences

assets/arrow-down.png

23.5 KB
Loading

assets/nef-plugin-action-export.png

109 KB
Loading

assets/nef-plugin-action-snippet.png

124 KB
Loading

assets/nef-plugin-extensions.png

12.6 KB
Loading

assets/nef-plugin-playgroundbook.png

267 KB
Loading

assets/nef-xcode-preferences.png

717 KB
Loading

assets/nef-xcode-shortcuts.png

208 KB
Loading

nef-plugin.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@
646646
buildSettings = {
647647
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
648648
COMBINE_HIDPI_IMAGES = YES;
649-
CURRENT_PROJECT_VERSION = 107;
649+
CURRENT_PROJECT_VERSION = 108;
650650
MARKETING_VERSION = 2.0.0;
651651
PRODUCT_BUNDLE_IDENTIFIER = com.fortysevendeg.nef;
652652
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)App";
@@ -660,7 +660,7 @@
660660
buildSettings = {
661661
CLANG_ENABLE_MODULES = YES;
662662
COMBINE_HIDPI_IMAGES = YES;
663-
CURRENT_PROJECT_VERSION = 107;
663+
CURRENT_PROJECT_VERSION = 108;
664664
MARKETING_VERSION = 2.0.0;
665665
PRODUCT_BUNDLE_IDENTIFIER = "com.fortysevendeg.nef-plugin";
666666
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -736,7 +736,7 @@
736736
buildSettings = {
737737
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
738738
COMBINE_HIDPI_IMAGES = YES;
739-
CURRENT_PROJECT_VERSION = 107;
739+
CURRENT_PROJECT_VERSION = 108;
740740
MARKETING_VERSION = 2.0.0;
741741
PRODUCT_BUNDLE_IDENTIFIER = com.fortysevendeg.nef;
742742
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)App";
@@ -750,7 +750,7 @@
750750
buildSettings = {
751751
CLANG_ENABLE_MODULES = YES;
752752
COMBINE_HIDPI_IMAGES = YES;
753-
CURRENT_PROJECT_VERSION = 107;
753+
CURRENT_PROJECT_VERSION = 108;
754754
MARKETING_VERSION = 2.0.0;
755755
PRODUCT_BUNDLE_IDENTIFIER = "com.fortysevendeg.nef-plugin";
756756
PRODUCT_NAME = "$(TARGET_NAME)";

nef-plugin/Support Files/Info-appstore.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<key>XCSourceEditorCommandIdentifier</key>
5858
<string>markdownPage</string>
5959
<key>XCSourceEditorCommandName</key>
60-
<string>Plaground → Markdown</string>
60+
<string>Playground → Markdown</string>
6161
</dict>
6262
</array>
6363
<key>XCSourceEditorExtensionPrincipalClass</key>

nef-plugin/Support Files/Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
<key>XCSourceEditorCommandIdentifier</key>
5858
<string>markdownPage</string>
5959
<key>XCSourceEditorCommandName</key>
60-
<string>Plaground → Markdown</string>
60+
<string>Playground → Markdown</string>
6161
</dict>
6262
<dict>
6363
<key>XCSourceEditorCommandClassName</key>
6464
<string>$(PRODUCT_MODULE_NAME).SourceEditorCommand</string>
6565
<key>XCSourceEditorCommandIdentifier</key>
6666
<string>playgroundBook</string>
6767
<key>XCSourceEditorCommandName</key>
68-
<string>Package → Playground Book (iPad)</string>
68+
<string>Swift Package → Playground Book (iPad)</string>
6969
</dict>
7070
</array>
7171
<key>XCSourceEditorExtensionPrincipalClass</key>

nef/PlaygroundBook/PlaygroundBookView.swift

+23
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,26 @@ struct PlaygroundBookView: View {
4545
static let nef = Image("nef-favicon")
4646
}
4747
}
48+
49+
50+
// MARK: - previews
51+
#if DEBUG
52+
import nef
53+
import BowEffects
54+
55+
struct PlaygroundBookView_Previews: PreviewProvider {
56+
static let console = PlaygroundBookConsole()
57+
58+
static var previews: some View {
59+
console.historical = "✓ It is a preview 1\n✓ It is a preview 2"
60+
console.task = "Preview"
61+
console.details = "Preview details"
62+
console.totalSteps = 5
63+
console.currentStep = 2
64+
console.duration = .seconds(15)
65+
console.status = .running
66+
67+
return PlaygroundBookView(console: console).frame(width: 800, height: 200, alignment: .center)
68+
}
69+
}
70+
#endif

0 commit comments

Comments
 (0)