Swana is a Swift project analyzer that generates an overview of your Swift project, including information about types, functions, properties, and used types.
- Analyzes Swift source files in a given project folder
- Generates an overview of types, functions, properties, and used types
- Supports classes, structs, enums, and protocols
- Prints the project overview in a human-readable format
- macOS 13.0 or later
- Swift 5.7 or later
Clone the repository:
git clone https://github.com/yourusername/swana.git
Build the project:
swift build -c release
Copy the executable to your desired location:
cp .build/release/Swana /usr/local/bin/swana
To analyze a Swift project, simply run the
swana command followed by the path to your project folder:
Swana will then generate and print an overview of your project, including information about types, functions, properties, and used types.
Files: /path/to/your/swift/project File: SourceFile.swift TypeName (class) ├───Functions: │ ├───functionName │ │ ├───Argument Types: Type1, Type2 │ │ ├───Return Type: ReturnType │ │ └───Used Types: Type1, Type2, ReturnType └───Properties: │ └───propertyName: PropertyType └───Used Types: Type1, Type2, ReturnType, PropertyType
ProjectOverview class: Represents an overview of a project, containing a URL for the project and dictionaries for the files and folders. Each file is represented by a
FileOverviewobject, with information about types, functions, and symbols in the file.
TypeInformation class: Represents information about a type, including its kind (class, struct, enum, or protocol), functions, properties, and used types.
FunctionInformation class: Represents information about a function, including its name, return type, argument types, and used types.
PropertyInformation struct: Represents information about a property, including its name and type.
Parser enum: Contains static functions for generating a project overview and analyzing a source file.
generateProjectOverview: Takes a URL for a project folder and returns a
ProjectOverviewobject representing the project.
analyzeSourceFile: Takes a
SourceFileSyntaxobject and returns a
FileOverviewobject representing the file.
printProjectOverview: Takes a
ProjectOverviewobject and prints information about the project to the console.
SourceFileVisitor class: A
SyntaxVisitorsubclass that visits the nodes in a source file’s syntax tree and extracts information about the types, functions, and properties in the file. It maintains a stack of type names as it visits the nodes and uses this information to build up the
This project is licensed under the MIT License. See the LICENSE file for details.