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

feat: added code editor #50

Merged
merged 1 commit into from
Mar 18, 2022

Conversation

MarcoCarnevali
Copy link
Collaborator

@MarcoCarnevali MarcoCarnevali commented Mar 18, 2022

This PR adds a new code-editor feature which consumes the Code-Editor library. It's not the best one but it's not bad and could be a good starting point. It's able to highlight the texts and format the code. The code wrapped inside a module so that we can easily change it with a new library or our custom solution in the future.
I've also added a SnapshotTest for it!

Screenshot 2022-03-18 at 13 10 12

@MarcoCarnevali MarcoCarnevali linked an issue Mar 18, 2022 that may be closed by this pull request
15 tasks
@MarcoCarnevali MarcoCarnevali self-assigned this Mar 18, 2022
@MarcoCarnevali MarcoCarnevali added the enhancement New feature or request label Mar 18, 2022
Copy link
Collaborator

@0xWDG 0xWDG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MacOS 11?

@@ -6,15 +6,30 @@ let package = Package(
name: "CodeEditModules",
defaultLocalization: "en",
platforms: [
.macOS(.v10_15),
.macOS(.v11),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the choice to bump the OS version from 10.15 to 11?
It can be a great replacement for Xcode, since Xcode is (going) to require 11+.

Xcode 13 includes SDKs for iOS 15, iPadOS 15, tvOS 15, watchOS 8, and macOS Big Sur 11.3. The Xcode 13 release supports on-device debugging for iOS 9 and later, tvOS 9 and later, and watchOS 2 and later. Xcode 13 requires a Mac running macOS 11.3 or later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems that the library needs v11. I think this can be a great starting point and I don't see us using this library in the future, so we are going to replace it anyway

import SwiftUI

/// CodeEditor is just a wrapper of the `CodeViewer` dependency
public struct CodeFileView: View {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the file does not match the struct name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch thank you!

@lukepistrol
Copy link
Member

Do you have a screenshot of the build?

@MarcoCarnevali
Copy link
Collaborator Author

Do you have a screenshot of the build?

Added!

@lukepistrol
Copy link
Member

Do you have a screenshot of the build?

Added!

Are the colors customizable?

@MarcoCarnevali
Copy link
Collaborator Author

Do you have a screenshot of the build?

Added!

Are the colors customizable?

There are a couple of themes we can choose from but by using this library we don't get a lot of customization... I've tried 5 different libraries and sadly this was the best. The intent of this PR is to have an usable code-editor that act as a starting point while in the mean-time we build our own solution

@lukepistrol
Copy link
Member

Ok I think it's good enough as a starting point.
We can merge after conflicts are resolved.

@MarcoCarnevali MarcoCarnevali merged commit 11ef6f9 into CodeEditApp:main Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

👀 Editor View
3 participants