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.
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
usingXcodeGen
. - Provide a script to clone the template into a new, ready-to-code project with customizable project name, author, and more.
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
andTPLProjectNameCore
are placeholders. These will be replaced with your actual project name during the install process.
- Clone this repo:
git clone https://github.com/hgq287/HGSwift.git
cd HGSwift
- Run the installer script:
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.
- Generate the Xcode project:
cd `YOUR PROJECT`
xcodegen
Now open the .xcodeproj
and start building 🚀
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.
- Swift 5.0+
- macOS 15+
- XcodeGen:
brew install xcodegen
Feel free to open issues, suggest improvements, or submit pull requests. All contributions are welcome!
MIT License – use it freely and feel free to credit if you find it helpful 🙌