-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Getting Started
Welcome to our guide to getting started on contributing to CodeEdit. This guide will help you understand the basic structure of the app and where to begin with. If you get stuck somewhere please have a look at the troubleshooting section or join the discussion on our Discord Server.
β οΈ If you're just starting out with Swift we highly recommend checking out 100 Days of Swift and 100 Days of SwiftUI by Paul Hudson to get a basic understanding of mastering Swift and the SwiftUI framework! Also check out our#swift-beginners
channel on our Discord Server
In order to contribute you first have to fork the repository by tapping the Fork button on the top left. This will create a copy in your own repository list.
After you forked the repository you can clone your fork to your local machine. For starters we recommend using a tool with a GUI like GitHub Desktop or Fork.
Important: Make sure you have at least
macOS 12 Monterey
installed since our deployment target ismacOS 12
. Otherwise the project will not build and run properly!
In order to contribute you first have to understand roughly how everything works together in our project. First of all you need to open the directory where you cloned the repository to in Finder. Inside that directory you will find a couple of files and sub-directories.
You want to open the CodeEdit.xcworkspace
file in Xcode.
Note: Do not open the
CodeEdit.xcodeproj
file since it will not include our internal modules which are required to build & run CodeEdit.
After opening the project in Xcode you will find the following top level folders:
CodeEditModules
CodeEdit
CodeEdit
is the main app target which we use to build and run the app. It contains all the necessary assets, configurations, and initialization code to build the app.
CodeEditModules
is our internal package of libraries where most of our code lives. It is divided in different libraries which allows us to build and run tests on individual parts of our app. It also leads to less conflicts when merging changes.
If you add a new feature please do so by adding a new module library to CodeEditModules
.
Note: Some parts of the app are still inside the
CodeEdit
main target. We are currently transitioning those to their own modules insideCodeEditModules
.
The structure of the libraries found in CodeEditModules
looks like this:
- CodeEditModules
- Modules
- Name_Of_The_Library
- src
- Tests
- Name_Of_The_Library
- Modules
The src
directory contains all the code of your library while the Tests
directory contains all tests.
To add a library just add a new folder inside Modules
and add the sub-folders as outlined above. Then add the following to the Package.swift
file:
Add this to the end of products
array:
.library(
name: "Name_Of_The_Library",
targets: ["Name_Of_The_Library"]
),
Then add this to the end of the targets
array:
.target(
name: "Name_Of_The_Library",
dependencies: [
// other library names (comma separated) your library depends on
],
path: "Modules/Name_Of_The_Library/src"
),
Lastly add the newly created library to the main project:
- Click on the
CodeEdit
main target folder. - Select
CodeEdit
underTargets
in the left sidebar. - Under
General
find theFrameworks, Libraries & Embedded Content
section. - Click the
+
icon on the bottom of the list and select your newly created module.