Skip to content

Project Architecture

Tawa Nicolas edited this page Jan 22, 2023 · 2 revisions

Introduction

This page describes the high-level project Architecture of the Phoenix App.

The Document-Based App

The Phoenix target in the Xcode Project is the editor of the PhoenixDocument. It is built in SwiftUI using the DocumentGroup that was introduced in macOS 11.

This target is a group of SwiftUI views that are created to modify the PhoenixDocument's values via @Bindings.

You will see a lot of Views that expect a Binding to their relevant type, like:

struct ComponentView: View {
    @Binding var component: Component
    …
}
struct ConfigurationView: View {
    @Binding var configuration: ProjectConfiguration
    … 
}

The Modules

Phoenix is used to generate and maintain its project's Swift Packages. You can find the Modules.ash file under the Modules folder, by opening it with the Phoenix editor you will be able to explore and learn about the dependencies between the modules.

At this point, there is no strict unified architecture across the complete project.

However, there are strict guidelines on the relationship between the modules. Each Component with code that has behavior includes a Contract with the public protocols and an Implementation.

Dependencies between components happen from Implementation to Contract. No implementation is allowed to depend on another component's implementation, unless it's a Swift Package that defines data types, like the PhoenixDocument and SwiftPackage components.

Features

Features like the Generate Feature are extracted into their own Component, and provide a public View that is plugged into the Editor view.

Clone this wiki locally