Skip to content

hgq287/hg-swift-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hg-swift-patterns

A collection of design pattern implementations in Swift
Explore practical examples of software design patterns written in clean, modern Swift.


Patterns Implemented

Creational

  • Unit of Work — Aggregate operations under a single transaction interface.

(Add more patterns here as you expand the project.)


📁 Project Structure

hg-swift-patterns/
├── creational/
│   └── UnitOfWork.swift
├── structural/
├── behavioral/
└── LICENSE
  • Each folder represents a category of design patterns.
  • Files contain focused, easy-to-read Swift code demonstrating each pattern.

Getting Started

Clone the Repository

git clone https://github.com/hgq287/hg-swift-patterns.git
cd hg-swift-patterns

Open in Xcode

Open the project or .swift files directly in Xcode to explore and run each pattern.

You can also create a Swift Playground and import the source code for easier experimentation.


Example Usage (Unit of Work)

let repository = Repository()
let unitOfWork = UnitOfWork(repository: repository)

unitOfWork.perform {
    // Queue multiple data operations
}.commit()

Requirements

  • Swift 5+
  • Xcode 16 or newer
  • macOS or iOS development environment

Contributing

Want to contribute another pattern or improve an existing one? Feel free to:

  • Fork the repository
  • Submit a pull request
  • Open an issue to discuss improvements

License

This project is licensed under the MIT License.


Author

Maintained by @hgq287.
Feel free to reach out or share improvements.

About

Real examples of design patterns implemented in Swift

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •