Skip to content
/ HGSwift Public

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

License

Notifications You must be signed in to change notification settings

hgq287/HGSwift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:
git clone https://github.com/hgq287/HGSwift.git
cd HGSwift
  1. 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.

  1. Generate the Xcode project:
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: 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 🙌

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published