An open API service indexing awesome lists of open source software.

https://github.com/hgq287/hgswift

Save time and build better apps with this Swift template for iOS and macOS, featuring a well-organized structure based on Clean Architecture
https://github.com/hgq287/hgswift

alamofire clean-architechture grdb swift swiftpackage swiftui xcodegen

Last synced: 11 months ago
JSON representation

Save time and build better apps with this Swift template for iOS and macOS, featuring a well-organized structure based on Clean Architecture

Awesome Lists containing this project

README

          

# HGSwift

Welcome to **HGSwift**, a Swift project template built with care to help you kickstart iOS and macOS apps using **Clean Architecture**. It's designed to give you a clean foundation with shared logic, modular structure, and easy setup using **XcodeGen**.

## Why HGSwift?

I created HGSwift to:

- Set up a solid, scalable Swift project structure in 30 minutes.
- Support both **iOS** and **macOS** with shared and platform-specific targets.
- Follow **Clean Architecture** principles out of the box.
- Automatically generate `.xcodeproj` using `XcodeGen`.
- Provide a script to clone the template into a new, ready-to-code project with customizable project name, author, and more.

## Project Structure

Here's a high-level look at the template structure:

```
HGSwift/
├── installer.swift
├── Makefile
├── LICENSE
├── CHANGLELOG.md
├── README.md
├── Out/ <-- Your project is placed here

└── Template/
├── project.yml <-- XcodeGen configuration
├── Makefile <-- Optional build/setup logic
├── codecov.yml <-- Code coverage config (optional)
├── configs/ <-- Build configs, environment settings
├── scripts/ <-- Utility scripts
├── Shared/ <-- Shared logic (networking, utils, etc.)
├── Tests/ <-- Unit tests
├── TPLProjectName/ <-- iOS/macOS app target (UI, AppDelegate, etc.)
├── TPLProjectNameCore/ <-- Core business logic, UseCases, Models
├── Vendors/ <-- External dependencies
└── TPLProjectName.xcodeproj <-- Xcode project (generated by XcodeGen)
```

> `TPLProjectName` and `TPLProjectNameCore` are placeholders. These will be replaced with your actual project name during the install process.

## How to Use

1. **Clone this repo:**

```bash
git clone https://github.com/hgq287/HGSwift.git
cd HGSwift
```

2. **Run the installer script:**

```bash
make install
```

The script will ask for:

- Project name
- Author
- Organization (optional)

It will then copy everything into a new folder and apply your custom names.

3. **Generate the Xcode project:**

```bash
cd `YOUR PROJECT`
xcodegen
```

Now open the `.xcodeproj` and start building 🚀

## Architecture Overview

This template follows **Clean Architecture**, including:

- **Core**: All business logic and domain models.
- **Shared**: Common code across platforms.
- **iOS/macOS targets**: Interactor layer, scenes, UI code.
- Clear separation of features
- Built to support testability and modular growth.

## Requirements

- Swift 5.0+
- macOS 15+
- [XcodeGen](https://github.com/yonaskolb/XcodeGen): `brew install xcodegen`

## Contributing

Feel free to open issues, suggest improvements, or submit pull requests. All contributions are welcome!

## License

MIT License – use it freely and feel free to credit if you find it helpful 🙌